diff --git a/dbm-ui/backend/db_meta/api/cluster/mongocluster/create.py b/dbm-ui/backend/db_meta/api/cluster/mongocluster/create.py index 07cb8a38bf..9dd33ebdff 100644 --- a/dbm-ui/backend/db_meta/api/cluster/mongocluster/create.py +++ b/dbm-ui/backend/db_meta/api/cluster/mongocluster/create.py @@ -108,7 +108,9 @@ def create_mongo_cluster( # 写入shard分片规则 for primary in primaries: - primary_obj = StorageInstance.objects.get(machine__ip=primary["ip"], port=primary["port"]) + primary_obj = StorageInstance.objects.get( + machine__ip=primary["ip"], port=primary["port"], machine__bk_cloud_id=bk_cloud_id, bk_biz_id=bk_biz_id + ) cluster.nosqlstoragesetdtl_set.create( instance=primary_obj, bk_biz_id=bk_biz_id, diff --git a/dbm-ui/backend/db_meta/api/cluster/mongorepset/create.py b/dbm-ui/backend/db_meta/api/cluster/mongorepset/create.py index 1ae8b5f85f..e43a9ea0e7 100644 --- a/dbm-ui/backend/db_meta/api/cluster/mongorepset/create.py +++ b/dbm-ui/backend/db_meta/api/cluster/mongorepset/create.py @@ -157,7 +157,12 @@ def create_mongoset( cluster=cluster, cluster_entry_type=ClusterEntryType.DNS, entry=storage["domain"], creator=creator ) cluster_entry.storageinstance_set.add( - StorageInstance.objects.get(machine__ip=storage["ip"], port=storage["port"]) + StorageInstance.objects.get( + machine__ip=storage["ip"], + port=storage["port"], + machine__bk_cloud_id=bk_cloud_id, + bk_biz_id=bk_biz_id, + ) ) cluster_entry.save() except Exception as e: # NOCC:broad-except(检查工具误报)