Skip to content

Commit

Permalink
fix(mongodb): 副本集部署方案 #7704
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 22531
  • Loading branch information
ygcyao authored and iSecloud committed Nov 1, 2024
1 parent 417a0ba commit 7d5e6bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions dbm-ui/backend/db_services/dbresource/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ClusterType.TendisTwemproxyRedisInstance: TendisCacheSpecFilter,
ClusterType.TwemproxyTendisSSDInstance: TendisSSDSpecFilter,
ClusterType.MongoShardedCluster: MongoDBShardSpecFilter,
ClusterType.MongoReplicaSet: MongoDBShardSpecFilter,
}


Expand Down
9 changes: 6 additions & 3 deletions dbm-ui/backend/db_services/dbresource/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,14 @@ def custom_filter(self):


class MongoDBShardSpecFilter(object):
"""mongodb分片集群的部署方案"""
"""mongodb集群的部署方案"""

def __init__(self, capacity, spec_cluster_type, spec_machine_type, **kwargs):
if spec_cluster_type != ClusterType.MongoShardedCluster or spec_machine_type != MachineType.MONGODB:
raise SpecOperateException(_("请保证输入的集群类型是MongoShardedCluster,且机器规格为mongodb"))
if (
spec_cluster_type not in [ClusterType.MongoShardedCluster, ClusterType.MongoReplicaSet]
or spec_machine_type != MachineType.MONGODB
):
raise SpecOperateException(_("请保证输入的集群类型是{},且机器规格为mongodb").format(spec_cluster_type))

self.specs: List[Dict[str, Any]] = []
mongodb_specs = Spec.objects.filter(
Expand Down

0 comments on commit 7d5e6bf

Please sign in to comment.