Skip to content

Commit

Permalink
feat(backend): redis-cluster 支持存储访问入口 #7712
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Nov 1, 2024
1 parent bd4e938 commit b3e9ab7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions dbm-ui/backend/db_meta/api/cluster/nosqlcomm/detail_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from django.utils.translation import gettext as _

from backend.db_meta.api.cluster.base.graph import Graphic, Group, LineLabel
from backend.db_meta.enums import ClusterEntryRole
from backend.db_meta.models import Cluster, StorageInstanceTuple

logger = logging.getLogger("root")
Expand All @@ -33,7 +34,7 @@ def scan_cluster(cluster: Cluster) -> Graphic:
).filter(receiver__cluster=cluster, ejector__cluster=cluster):
ejector_instance = tr.ejector
receiver_instance = tr.receiver
ejector_instance_node, ejector_instance_grp = graph.add_node(ejector_instance)
ejector_instance_node, ejector_instance_group = graph.add_node(ejector_instance)
receiver_instance_node, receiver_instance_group = graph.add_node(receiver_instance)
graph.add_line(source=ejector_instance_node, target=receiver_instance_node, label=LineLabel.Rep)

Expand All @@ -47,8 +48,14 @@ def scan_cluster(cluster: Cluster) -> Graphic:
graph.add_line(source=proxy_instance_group, target=backend_instance_grp, label=LineLabel.Access)

master_bind_entry_group = Group(node_id="master_bind_entry_group", group_name=_("访问入口(主)"))
for be in proxy_instance.bind_entry.all():
dummy_be_node, master_bind_entry_group = graph.add_node(be, to_group=master_bind_entry_group)
for bind_entry in proxy_instance.bind_entry.filter(role=ClusterEntryRole.MASTER_ENTRY.value):
dummy_be_node, master_bind_entry_group = graph.add_node(bind_entry, to_group=master_bind_entry_group)
graph.add_line(source=master_bind_entry_group, target=proxy_instance_group, label=LineLabel.Bind)

# 存储层访问入口
nodes_bind_entry_group = Group(node_id="nodes_bind_entry_group", group_name=_("存储层访问入口"))
for bind_entry in proxy_instance.bind_entry.filter(role=ClusterEntryRole.NODE_ENTRY.value):
dummy_be_node, nodes_bind_entry_group = graph.add_node(bind_entry, to_group=nodes_bind_entry_group)
graph.add_line(source=nodes_bind_entry_group, target=backend_instance_grp, label=LineLabel.Bind)

return graph

0 comments on commit b3e9ab7

Please sign in to comment.