1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

kcc graphs: site edges in colour, labeled with DNs

This makes it easy to see where the site edges objects are, and
what sites they refer too.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2018-01-07 22:17:43 +13:00 committed by Andrew Bartlett
parent cd2365175f
commit 03bd7c20f0
3 changed files with 13 additions and 7 deletions

View File

@ -2583,15 +2583,20 @@ class KCC(object):
dot_file_dir=self.dot_file_dir)
dot_edges = []
dot_colours = []
for link in self.sitelink_table.values():
from hashlib import md5
colour = '#' + md5(link.dnstr).hexdigest()[:6]
for a, b in itertools.combinations(link.site_list, 2):
dot_edges.append((str(a), str(b)))
dot_edges.append((a[1], b[1]))
dot_colours.append(colour)
properties = ('connected',)
verify_and_dot('dsa_sitelink_initial', dot_edges,
directed=False,
label=self.my_dsa_dnstr, properties=properties,
debug=DEBUG, verify=self.verify,
dot_file_dir=self.dot_file_dir)
dot_file_dir=self.dot_file_dir,
edge_colors=dot_colours)
if forget_local_links:
for dsa in self.my_site.dsa_table.values():

View File

@ -293,7 +293,7 @@ def create_edge(con_type, site_link, guid_to_vertex):
e = MultiEdge()
e.site_link = site_link
e.vertices = []
for site_guid in site_link.site_list:
for site_guid, site_dn in site_link.site_list:
if str(site_guid) in guid_to_vertex:
e.vertices.extend(guid_to_vertex.get(str(site_guid)))
e.repl_info.cost = site_link.cost

View File

@ -2148,8 +2148,8 @@ class SiteLink(object):
text = text + "0x%X " % slot
text = text + "]"
for dnstr in self.site_list:
text = text + "\n\tsite_list=%s" % dnstr
for guid, dn in self.site_list:
text = text + "\n\tsite_list=%s (%s)" % (guid, dn)
return text
def load_sitelink(self, samdb):
@ -2190,8 +2190,9 @@ class SiteLink(object):
for value in msg["siteList"]:
dsdn = dsdb_Dn(samdb, value.decode('utf8'))
guid = misc.GUID(dsdn.dn.get_extended_component('GUID'))
if guid not in self.site_list:
self.site_list.append(guid)
dnstr = str(dsdn.dn)
if (guid, dnstr) not in self.site_list:
self.site_list.append((guid, dnstr))
if "schedule" in msg:
self.schedule = ndr_unpack(drsblobs.schedule, value)