From d68387774dd25c38dd1cf4a8a03fb8f5032178b4 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 18 Mar 2015 11:33:53 +1300 Subject: [PATCH] KCC: attempt to use correct verification tests for graphs Before they were liberally assigned because the failures were as interesting as the passes. Also add a stub for the forest_of_rings test. Signed-off-by: Douglas Bagnall Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- python/samba/kcc_utils.py | 4 ++++ source4/scripting/bin/samba_kcc | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/python/samba/kcc_utils.py b/python/samba/kcc_utils.py index 69f86209490..e9ddc91765a 100644 --- a/python/samba/kcc_utils.py +++ b/python/samba/kcc_utils.py @@ -2476,6 +2476,10 @@ def verify_graph_multi_edge_forest(edges, vertices, edge_vertices): return +def verify_graph_forest_of_rings(edges, vertices, edge_vertices): + """The graph should consist of clusters of node connected in rings, + with the connections between the cdlusters forming a forest.""" + pass def verify_graph_no_lonely_vertices(edges, vertices, edge_vertices): diff --git a/source4/scripting/bin/samba_kcc b/source4/scripting/bin/samba_kcc index 9832b4a19ec..679d7fb79d9 100755 --- a/source4/scripting/bin/samba_kcc +++ b/source4/scripting/bin/samba_kcc @@ -1707,8 +1707,6 @@ class KCC(object): for a, b in itertools.chain(*(itertools.combinations(edge.vertices, 2) for edge in e_set.edges))] graph_nodes = [v.site.site_dnstr for v in graph.vertices] - verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', - 'directed_double_ring') if opts.dot_files: write_dot_file('edgeset_%s' % (edgeType,), graph_edges, vertices=graph_nodes, @@ -1716,7 +1714,7 @@ class KCC(object): if opts.verify: verify_graph('spanning tree edge set %s' % edgeType, graph_edges, vertices=graph_nodes, - properties=verify_properties, debug=DEBUG) + properties=('complete', 'connected'), debug=DEBUG) # Run dijkstra's algorithm with just the red vertices as seeds # Seed from the full replicas @@ -1739,8 +1737,7 @@ class KCC(object): if opts.verify or opts.dot_files: graph_edges = [(e.v1.site.site_dnstr, e.v2.site.site_dnstr) for e in internal_edges] graph_nodes = [v.site.site_dnstr for v in graph.vertices] - verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', - 'directed_double_ring') + verify_properties = ('multi_edge_forest',) verify_and_dot('prekruskal', graph_edges, graph_nodes, label=label, properties=verify_properties, debug=DEBUG, verify=opts.verify, dot_files=opts.dot_files) @@ -2255,7 +2252,7 @@ class KCC(object): dot_edges.append((v2, v1.dsa_dnstr)) dot_vertices.add(v2) - verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', 'directed_double_ring') + verify_properties = ('connected', 'directed_double_ring') verify_and_dot('intrasite_post_ntdscon', dot_edges, dot_vertices, label='%s__%s__%s' % (site_local.site_dnstr, nctype_lut[nc_x.nc_type], nc_x.nc_dnstr), properties=verify_properties, debug=DEBUG, verify=opts.verify, @@ -2456,7 +2453,7 @@ class KCC(object): for dsa in site.dsa_table.values(): for con in dsa.connect_table.values(): dot_edges.append((dsa.dsa_dnstr, con.from_dnstr)) - verify_properties = ('complete', 'connected', 'multi_edge_forest', 'forest', 'directed_double_ring') + verify_properties = ('connected', 'forest_of_rings') verify_and_dot('dsa_final', dot_edges, label=self.my_dsa_dnstr, properties=verify_properties, debug=DEBUG, verify=opts.verify, dot_files=opts.dot_files, directed=True)