summaryrefslogtreecommitdiff
path: root/python/samba/kcc
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-01-07 22:17:43 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-05-31 01:57:16 +0200
commit03bd7c20f0846d6b231573b310190d3e0a747f00 (patch)
treed5488a42e4005031b2e6d569f7e836abd01cf3ad /python/samba/kcc
parentcd2365175f5e9d5b5e2725fecf07b3862d3923df (diff)
downloadsamba-03bd7c20f0846d6b231573b310190d3e0a747f00.tar.gz
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>
Diffstat (limited to 'python/samba/kcc')
-rw-r--r--python/samba/kcc/__init__.py9
-rw-r--r--python/samba/kcc/graph.py2
-rw-r--r--python/samba/kcc/kcc_utils.py9
3 files changed, 13 insertions, 7 deletions
diff --git a/python/samba/kcc/__init__.py b/python/samba/kcc/__init__.py
index fae9dbd13d3..1b22bf73a9f 100644
--- a/python/samba/kcc/__init__.py
+++ b/python/samba/kcc/__init__.py
@@ -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():
diff --git a/python/samba/kcc/graph.py b/python/samba/kcc/graph.py
index 9dfc541548f..1e63f7c7629 100644
--- a/python/samba/kcc/graph.py
+++ b/python/samba/kcc/graph.py
@@ -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
diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py
index 23fbd40e904..1457ea355e0 100644
--- a/python/samba/kcc/kcc_utils.py
+++ b/python/samba/kcc/kcc_utils.py
@@ -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)