Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Nov 15, 2024
1 parent 26d814f commit 741a55e
Show file tree
Hide file tree
Showing 42 changed files with 68 additions and 60 deletions.
3 changes: 0 additions & 3 deletions dbm-ui/backend/db_dirty/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class PoolType(str, StructuredEnum):
Resource = EnumField("resource", _("资源池"))
# 回收池表示已经挪到cc待回收,不在dbm流转
Recycled = EnumField("recycled", _("已回收"))
# 已部署表示主机正在使用
APPLY = EnumField("apply", _("已部署"))


class MachineEventType(str, StructuredEnum):
Expand All @@ -48,5 +46,4 @@ class MachineEventType(str, StructuredEnum):
MachineEventType.ReturnResource: PoolType.Resource,
MachineEventType.Recycled: PoolType.Recycled,
MachineEventType.UndoImport: PoolType.Recycled,
MachineEventType.ApplyResource: PoolType.APPLY,
}
5 changes: 1 addition & 4 deletions dbm-ui/backend/db_dirty/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,4 @@ def filter_ips(self, queryset, name, value):

class Meta:
model = DirtyMachine
fields = {
"bk_biz_id": ["exact"],
"creator": ["exact"],
}
fields = {"bk_biz_id": ["exact"], "creator": ["exact"], "pool": ["exact"]}
2 changes: 1 addition & 1 deletion dbm-ui/backend/db_meta/models/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __status_flag(self):
if self.storageinstance_set.filter(status=InstanceStatus.UNAVAILABLE.value).exists():
flag_obj |= ClusterRedisStatusFlags.RedisUnavailable
# sqlserver ha
if self.cluster_type == ClusterType.SqlserverHA.value:
elif self.cluster_type == ClusterType.SqlserverHA.value:
flag_obj = ClusterSqlserverStatusFlags(0)
if self.storageinstance_set.filter(
status=InstanceStatus.UNAVAILABLE.value, instance_inner_role=InstanceInnerRole.MASTER.value
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/db_services/dbbase/resources/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def export_instance(cls, bk_biz_id: int, bk_host_ids: list) -> HttpResponse:
@classmethod
def get_temporary_cluster_info(cls, cluster, ticket_type):
"""如果当前集群是临时集群,则补充临时集群相关信息。"""
tags = [tag.key for tag in cluster.tag_set.all()]
tags = [tag.key for tag in cluster.tags.all()]
if SystemTagEnum.TEMPORARY.value not in tags:
return {}
record = ClusterOperateRecord.objects.filter(cluster_id=cluster.id, ticket__ticket_type=ticket_type).first()
Expand Down
8 changes: 8 additions & 0 deletions dbm-ui/backend/flow/engine/controller/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

from backend.db_meta.enums import ClusterType
from backend.flow.engine.bamboo.scene.cloud.mysql_machine_clear_flow import ClearMysqlMachineFlow
from backend.flow.engine.bamboo.scene.spider.append_deploy_ctl_flow import AppendDeployCTLFlow
from backend.flow.engine.bamboo.scene.spider.import_sqlfile_flow import ImportSQLFlow
from backend.flow.engine.bamboo.scene.spider.remote_local_slave_recover import TenDBRemoteSlaveLocalRecoverFlow
Expand Down Expand Up @@ -241,3 +242,10 @@ def tendbcluster_standardize_scene(self):
def metadata_import_scene(self):
flow = SpiderClusterMetadataImportFlow(root_id=self.root_id, data=self.ticket_data)
flow.import_meta()

def tendbcluster_machine_clear_scene(self):
"""
清理mysql机器
"""
flow = ClearMysqlMachineFlow(root_id=self.root_id, data=self.ticket_data)
flow.run_flow()
2 changes: 2 additions & 0 deletions dbm-ui/backend/flow/utils/clear_machine_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@

db_type_script_map = {
DBType.MySQL.value: mysql_clear_machine_script,
DBType.TenDBCluster.value: mysql_clear_machine_script,
DBType.Sqlserver.value: sqlserver_clear_machine_script,
}

db_type_account_user_map = {
DBType.MySQL.value: DBA_ROOT_USER,
DBType.TenDBCluster.value: DBA_ROOT_USER,
DBType.Sqlserver.value: WINDOW_SYSTEM_JOB_USER,
}
9 changes: 6 additions & 3 deletions dbm-ui/backend/ticket/builders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ def patch_info_affinity_location(self, roles=None):
from backend.ticket.builders.common.base import fetch_cluster_ids

cluster_ids = fetch_cluster_ids(self.ticket_data["infos"])
id__cluster = {cluster.id: cluster for cluster in Cluster.objects.filter(id__in=cluster_ids)}
cluster_id_map = {cluster.id: cluster for cluster in Cluster.objects.filter(id__in=cluster_ids)}
for info in self.ticket_data["infos"]:
cluster = id__cluster[info.get("cluster_id") or info.get("src_cluster")]
cluster = cluster_id_map[fetch_cluster_ids(info)[0]]
self.patch_affinity_location(cluster, info["resource_spec"], roles)
# 工具箱操作,补充业务和云区域ID
info.update(bk_cloud_id=cluster.bk_cloud_id, bk_biz_id=self.ticket.bk_biz_id)
Expand All @@ -270,7 +270,10 @@ class RecycleParamBuilder(FlowParamBuilder):
职责:获取单据中的下架机器,并走回收流程
"""

controller_map = {DBType.MySQL.value: "MySQLController.mysql_machine_clear_scene"}
controller_map = {
DBType.MySQL.value: "MySQLController.mysql_machine_clear_scene",
DBType.TenDBCluster.value: "MySQLController.mysql_machine_clear_scene",
}

def __init__(self, ticket: Ticket):
super().__init__(ticket)
Expand Down
7 changes: 6 additions & 1 deletion dbm-ui/backend/ticket/builders/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def fetch_host_ids(details: Dict[str, Any]) -> List[int]:
def fetch_apply_hosts(details: Dict[str, Any]) -> List[Dict]:
role_hosts = get_target_items_from_details(details, match_keys=["nodes"])
hosts = list(itertools.chain(*[h for hosts in role_hosts for h in hosts.values()]))
return hosts
# 适配backend_group分组
master_slave_hosts = get_target_items_from_details(hosts, match_keys=["master", "slave"])
apply_hosts = [host for host in hosts if "master" not in host] + master_slave_hosts
return apply_hosts


def fetch_recycle_hosts(details: Dict[str, Any]) -> List[Dict]:
Expand Down Expand Up @@ -132,6 +135,8 @@ class InstanceInfoSerializer(HostInfoSerializer):
class HostRecycleSerializer(serializers.Serializer):
"""主机回收信息"""

DEFAULT = {"for_biz": PLAT_BIZ_ID, "ip_dest": IpDest.Fault}

for_biz = serializers.IntegerField(help_text=_("目标业务"), required=False, default=PLAT_BIZ_ID)
ip_dest = serializers.ChoiceField(help_text=_("机器流向"), choices=IpDest.get_choices(), default=IpDest.Fault)

Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/common/bigdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class BigDataReplaceDetailSerializer(BigDataSingleClusterOpsDetailsSerializer):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
# 校验替换前后角色类型和数量一致
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/doris/doris_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class DorisDestroyDetailSerializer(BigDataTakeDownDetailSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class DorisDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/doris/doris_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NodesSerializer(serializers.Serializer):
observer = serializers.ListField(help_text=_("observer信息列表"), child=serializers.DictField())

old_nodes = NodesSerializer(help_text=_("nodes节点列表"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
super().validate(attrs)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/es/es_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NodesSerializer(serializers.Serializer):
client = serializers.ListField(help_text=_("client信息列表"), child=serializers.DictField())

old_nodes = NodesSerializer(help_text=_("nodes节点列表"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
super().validate(attrs)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/hdfs/hdfs_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NodesSerializer(serializers.Serializer):
datanode = serializers.ListField(help_text=_("broker信息列表"), child=serializers.DictField())

old_nodes = NodesSerializer(help_text=_("nodes节点信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
super().validate(attrs)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/kafka/kafka_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class NodesSerializer(serializers.Serializer):
broker = serializers.ListField(help_text=_("broker信息列表"), child=serializers.DictField())

old_nodes = NodesSerializer(help_text=_("nodes节点信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
super().validate(attrs)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/mysql/mysql_ha_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class MysqlHADestroyDetailSerializer(MySQLClustersTakeDownDetailsSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class MysqlHADestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MigrateClusterInfoSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("机器来源"), choices=IpSource.get_choices(), required=False, default=IpSource.MANUAL_INPUT
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("迁移主从信息"), child=MigrateClusterInfoSerializer())
backup_source = serializers.ChoiceField(
help_text=_("备份源"), choices=MySQLBackupSource.get_choices(), default=MySQLBackupSource.REMOTE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ReadOnlySlaveSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("机器来源"), choices=IpSource.get_choices(), required=False, default=IpSource.MANUAL_INPUT
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
backup_source = serializers.ChoiceField(help_text=_("备份源"), choices=MySQLBackupSource.get_choices())
infos = serializers.ListField(help_text=_("添加信息"), child=InfoSerializer())
force = serializers.BooleanField(help_text=_("是否强制执行"), required=False, default=False)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/mysql/mysql_proxy_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OldProxySerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("机器来源"), choices=IpSource.get_choices(), required=False, default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
force = serializers.BooleanField(help_text=_("是否强制替换"), required=False, default=False)
infos = serializers.ListField(help_text=_("替换信息"), child=SwitchInfoSerializer())

Expand Down
13 changes: 3 additions & 10 deletions dbm-ui/backend/ticket/builders/mysql/mysql_restore_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from backend.ticket.builders.common.constants import MySQLBackupSource
from backend.ticket.builders.mysql.base import BaseMySQLHATicketFlowBuilder, MySQLBaseOperateDetailSerializer
from backend.ticket.constants import TicketType
from backend.utils.basic import get_target_items_from_details


class MysqlRestoreSlaveDetailSerializer(MySQLBaseOperateDetailSerializer):
Expand All @@ -45,7 +44,7 @@ class OldSlaveSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("机器来源"), choices=IpSource.get_choices(), required=False, default=IpSource.MANUAL_INPUT
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
# 校验集群是否可用,集群类型为高可用
Expand All @@ -62,11 +61,6 @@ def validate(self, attrs):
attrs, instance_key=["old_slave"], cluster_key=["cluster_ids"], role=InstanceInnerRole.SLAVE
)

# 校验新机器的云区域与集群一致
super(MysqlRestoreSlaveDetailSerializer, self).validate_hosts_clusters_in_same_cloud_area(
attrs, host_key=["new_slave"], cluster_key=["cluster_ids"]
)

return attrs


Expand All @@ -91,9 +85,9 @@ class MysqlRestoreSlaveResourceParamBuilder(BaseOperateResourceParamBuilder):
@classmethod
def patch_slave_subzone(cls, ticket_data):
# TODO: 后续改造为,尽量与原slave一致,不一致再满足亲和性
slave_host_ids = get_target_items_from_details(ticket_data, match_keys=["bk_host_id"])
slave_host_ids = [s["bk_host_id"] for info in ticket_data["infos"] for s in info["old_nodes"]["old_slave"]]
slaves = StorageInstance.objects.prefetch_related("as_receiver__ejector__machine", "machine").filter(
machine__bk_host_id__in=slave_host_ids, cluster_type=ClusterType.TenDBCluster
machine__bk_host_id__in=slave_host_ids, cluster_type=ClusterType.TenDBHA
)
slave_host_map = {slave.machine.bk_host_id: slave for slave in slaves}
for info in ticket_data["infos"]:
Expand Down Expand Up @@ -128,5 +122,4 @@ class MysqlRestoreSlaveFlowBuilder(BaseMySQLHATicketFlowBuilder):
serializer = MysqlRestoreSlaveDetailSerializer
inner_flow_builder = MysqlRestoreSlaveParamBuilder
resource_batch_apply_builder = MysqlRestoreSlaveResourceParamBuilder
inner_flow_name = _("Slave重建执行")
need_patch_recycle_host_details = True
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


class MysqlSingleDestroyDetailSerializer(MySQLClustersTakeDownDetailsSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class MysqlSingleDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/pulsar/pulsar_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NodesSerializer(serializers.Serializer):
bookkeeper = serializers.ListField(help_text=_("bookkeeper信息列表"), child=serializers.DictField())

old_nodes = serializers.JSONField(help_text=_("节点列表信息"), required=False)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
super().validate(attrs)
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/redis/redis_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


class RedisDestroyDetailSerializer(RedisSingleOpsBaseDetailSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class RedisDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HostInfoSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL.value
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class HostInfoSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def validate(self, attr):
return attr

infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer())
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class RedisDataStructureTaskDeleteParamBuilder(builders.FlowParamBuilder):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OldProxySerializer(serializers.Serializer):
)

infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer())
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
clusters = Cluster.objects.filter(id__in=fetch_cluster_ids(attrs)).prefetch_related("proxyinstance_set")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class BackendGroupSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def validate(self, attr):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer(), allow_empty=False)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def validate(self, attr):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)
infos = serializers.ListField(help_text=_("批量操作参数列表"), child=InfoSerializer(), allow_empty=False)


Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/riak/riak_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class RiakDestroyDetailSerializer(BigDataTakeDownDetailSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class RiakDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/backend/ticket/builders/riak/riak_shrink.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RiakNodeSerializer(serializers.Serializer):

cluster_id = serializers.IntegerField(help_text=_("集群ID"))
nodes = RiakNodeSerializer(help_text=_("缩容信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
return attrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


class SQLServerDestroyDetailSerializer(SQLServerTakeDownDetailsSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class SQLServerDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class OldSlaveSerializer(serializers.Serializer):
ip_source = serializers.ChoiceField(
help_text=_("主机来源"), choices=IpSource.get_choices(), default=IpSource.RESOURCE_POOL
)
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)

def validate(self, attrs):
# 校验实例的角色为slave
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class TendbDestroyDetailSerializer(TendbClustersTakeDownDetailsSerializer):
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"))
ip_recycle = HostRecycleSerializer(help_text=_("主机回收信息"), default=HostRecycleSerializer.DEFAULT)


class TendbDestroyFlowParamBuilder(builders.FlowParamBuilder):
Expand Down
Loading

0 comments on commit 741a55e

Please sign in to comment.