Skip to content

Commit

Permalink
feat(mongodb): Mongo同业务相同IP支持 #3872
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepaup authored and zhangzhw8 committed Apr 11, 2024
1 parent 9e3321a commit 1300d06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dbm-ui/backend/db_meta/api/cluster/mongocluster/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion dbm-ui/backend/db_meta/api/cluster/mongorepset/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(检查工具误报)
Expand Down

0 comments on commit 1300d06

Please sign in to comment.