From 41bb42d71217dc0175788a983fdc027645b04519 Mon Sep 17 00:00:00 2001 From: ycggyao Date: Thu, 9 Jan 2025 19:05:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend):=20mysql,tendbcluster=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8=E5=8F=AF=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B8=BB=E6=9C=BA=20#9010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ticket/builders/tendbcluster/tendb_master_fail_over.py | 4 +++- .../ticket/builders/tendbcluster/tendb_restore_slave.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_master_fail_over.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_master_fail_over.py index 38a482e2e2..d41d4e9a31 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_master_fail_over.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_master_fail_over.py @@ -14,7 +14,7 @@ from backend.flow.engine.controller.spider import SpiderController from backend.ticket import builders -from backend.ticket.builders.tendbcluster.base import BaseTendbTicketFlowBuilder +from backend.ticket.builders.tendbcluster.base import BaseTendbTicketFlowBuilder, TendbBaseOperateDetailSerializer from backend.ticket.builders.tendbcluster.tendb_master_slave_switch import TendbMasterSlaveSwitchDetailSerializer from backend.ticket.constants import TicketType @@ -24,6 +24,8 @@ class TendbMasterFailOverDetailSerializer(TendbMasterSlaveSwitchDetailSerializer serializers.BooleanField(help_text=_("是否检测数据同步延时情况")) def validate(self, attrs): + # 校验集群是否可用,集群类型为tendbcluster + super(TendbBaseOperateDetailSerializer, self).validate_cluster_can_access(attrs) if not attrs["force"]: raise serializers.ValidationError(_("主故障切换场景需要强制执行")) diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_restore_slave.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_restore_slave.py index 0660bd8b5e..557a10a460 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_restore_slave.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_restore_slave.py @@ -21,12 +21,12 @@ from backend.ticket.builders.common.base import BaseOperateResourceParamBuilder, HostInfoSerializer from backend.ticket.builders.common.constants import MySQLBackupSource from backend.ticket.builders.mysql.mysql_restore_slave import MysqlRestoreSlaveDetailSerializer -from backend.ticket.builders.tendbcluster.base import BaseTendbTicketFlowBuilder +from backend.ticket.builders.tendbcluster.base import BaseTendbTicketFlowBuilder, TendbBaseOperateDetailSerializer from backend.ticket.constants import TicketType from backend.utils.basic import get_target_items_from_details -class TendbClusterRestoreSlaveDetailSerializer(MysqlRestoreSlaveDetailSerializer): +class TendbClusterRestoreSlaveDetailSerializer(MysqlRestoreSlaveDetailSerializer, TendbBaseOperateDetailSerializer): class RestoreInfoSerializer(serializers.Serializer): old_slave = HostInfoSerializer(help_text=_("旧从库 IP")) new_slave = HostInfoSerializer(help_text=_("新从库 IP"), required=False) @@ -41,7 +41,7 @@ class RestoreInfoSerializer(serializers.Serializer): def validate(self, attrs): # 校验集群是否可用,集群类型为tendbcluster - super(MysqlRestoreSlaveDetailSerializer, self).validate_cluster_can_access(attrs) + super(TendbBaseOperateDetailSerializer, self).validate_cluster_can_access(attrs) super(MysqlRestoreSlaveDetailSerializer, self).validated_cluster_type(attrs, ClusterType.TenDBCluster) # 校验新机器的云区域与集群一致 if attrs["ip_source"] == IpSource.MANUAL_INPUT: