1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

306 Commits

Author SHA1 Message Date
Douglas Bagnall
c73a571353 KCC: fix combine_repl_info
Previous the supposedly combined repl_info was always the default, all
0x11, repl_info.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
ff7a0902dd KCC: clarify a couple of comments in graph.py
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
c182df9969 KCC: KCC object keeps lp and creds for live pings
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
215f1c2c53 KCC improve docstring for KCC.load_samdb()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
21b792b7ba KCC improve docstring for KCC.construct_intrasite_graph()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
62a7ae5727 KCC improve docstring for update_rodc_connection()
Also make a short-cut early exit visually shorter and earlier.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
257219c836 KCC improve docstring for KCC.create_intersite_connections()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
6aa9240cb8 KCC improve docstring for refresh_failed_links_connections()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
032291f492 KCC: shift samba.ldif_utils to samba.kcc.ldif_import_export
These functions are really only of use for KCC, and they only import and
export rather than be general utils.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
db56d4ae3b KCC: remove remnants of script from samba/kcc/__init__
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
427d05d1ac KCC: shift samba.kcc intersite functions to samba.kcc.graph
So samba.kcc.graph is the place to look for everything intersite.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
b0e6a74362 KCC: split kcc_utils into samba.kcc.{kcc_utils,graph}
graph.py has the intersite graph stuff.
kcc_utils does intrasite, namespace, &cetera.

The wildcard imports are tidied up, so samba_kcc imports unix2nttime
directly rather than letting it fall out of kcc_utils.

Intersite graph functions samba/kcc/__init__.py are also shifted into
graph.py.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
8d6f256f38 KCC: rearrange 3 functions in samba.kcc __init__
This module still isn't actually used.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
7cd35051c8 KCC: split and shift samba.graph_utils -> samba.kcc.{graph_utils,debug}
The debug module contains debug functions and colours.

Graph_utils keeps the DOT file generation and graph verification code.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
f37b89c157 KCC: Reduce brokenness of samba.kcc module
This module is still not being used, and is being fixed slowly to make
it clear what is happening. Here we remove references to globals in
the samba_kcc script (notably opts), and instead add the various
options as KCC.__init__ arguments.

There is more to come.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
94b1258501 KCC: Copy KCC core out of samba_kcc into samba.kcc module
The "module" is not actually used at this point, which is just as well
as it would be utterly broken. This copy is just to show that the
eventual move is really a move and not a complete rewrite.

Note that if this file is not executable (and it really shouldn't be),
this commit causes the samba.tests.source test to fail with "Files
with shebang line that are not executable".

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-06-12 06:57:13 +02:00
Douglas Bagnall
d176e8d441 KCC: tests/ldif_utils tests ldif import
Thanks as usual to Andrew Bartlett for his help.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-30 21:05:24 +02:00
Douglas Bagnall
55850a3dad KCC: ldif_utils: ldif_to_samdb doesn't need creds; begin selftest
The tests are based on the testdata/ldif-utils-test-multisite.ldif
which describes a multisite windows network. It was constructed by
Garming Sam.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-30 21:05:24 +02:00
Garming Sam
6d99636cf1 kcc: prevent non-determinism when running translation
RODC connections could appear first some runs while not always. This would
mean that repsFrom could accidentally be deleted.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-30 21:05:24 +02:00
Douglas Bagnall
29546f2f9f KCC: test suite for the graph_utils
This found a few bugs in the tests which were fixed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 29 13:55:54 CEST 2015 on sn-devel-104
2015-05-29 13:55:54 +02:00
Douglas Bagnall
87c68e0bc9 KCC: remove print statements from kcc_utils
debug noise should not go to stdout

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:22 +02:00
Douglas Bagnall
08e41b42af KCC: more pep8 for kcc_utils
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:22 +02:00
Douglas Bagnall
edacc0314f KCC: pep8 pass over graph_utils.py
Using the `flake8` tool, which also spots e.g. unused imports.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:22 +02:00
Douglas Bagnall
4e781857e3 KCC: add graph tests of robustness against edge and vertex failure
These tests are themselves tested in a later patch.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:22 +02:00
Douglas Bagnall
cb8b99e335 KCC: improve directed_double_ring graph check
The previous test assumed there would be only a double directed ring
but in fact there could be other edges.  In large graphs there are
certain to be more edges.

Now we want to be sure there is a complete ring apart from any other
connections. This is called the Hamiltonian path problem and takes
exponential time in general, so now our test is that it looks *quite*
a lot like a complete ring.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:22 +02:00
Douglas Bagnall
04c678fd08 KCC: slight rewrite for the sake of pep8
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
4ffd37df5e KCC: more pep8, using temp variables in places
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
4770bc0f62 KCC: fix square bracket padding for pep8
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
15dfb58424 KCC: deduplicate connection schedule creation
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
768d79c703 KCC: reformat kcc_util object __str__ for pep8
Many lines were too long, which is to a large extent fixed by replacing
`text = text +` with `text +=`.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
e33fe2bf24 KCC: pep8 conformance
I ran the files through the pep8 command-line tool.

Most changes are for line length, inline comment formatting, adjusting
numbers of blank lines, and the indentation of conditions on if
statements.

This is pretty useless work, but I thought I would have a go with the
pep8 tool, and it came up with a lot of complaints.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
39da46e72c KCC: Help RW DCs to ignore RODCs when doing kcc
As far as writable DCs are concerned, RODCs don't even exist. So we make
tables that leave out the RO ones.

An RODC needs to know itself as well as writable DCs, so we add it in
that case.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
ceb6ab99b5 KCC: use less verbose constructions in a few places
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 11:08:21 +02:00
Douglas Bagnall
5aa3fca44d KCC: colour dot graph vertices as well as edges
It's quicker to see who is RODC.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:27 +02:00
Douglas Bagnall
4d0f892a1a KCC: Comment about schedule types
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:27 +02:00
Douglas Bagnall
73fe7ed8ec KCC: use more efficient, less polluting dictionary operations
`in d` is more efficient and idiomatic than `in d.keys()`.

`for v in d.values()` is better than `for k, v in d.items()` when `k`
is not used.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:27 +02:00
Douglas Bagnall
b1c9039d51 KCC: a whole lot of debugging messages
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:27 +02:00
Douglas Bagnall
bb945df0ef KCC: set site topo_generator in RO case, for debug clarity
This has no actual effect except that it makes the Site object print with
the site_topo_generator that is actually used (because RODCs are always
their own topology generators and this variable doesn't affect that).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
6146a8a3f8 KCC: reuse convert_schedule_to_repltimes() for Sitelinks
This means wrenching it out of NTDSConnection, where it didn't really need to be anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
3aad85f2a2 KCC: fix NTDSConnection.convert_schedule_to_repltimes
There were two bugs: the wrong nibbles were being added, and they weren't actually being saved.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
a8a172471f KCC: InternalEdge should know its sitelink
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
4ad04a0f6f KCC: minor formatting changes
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
5c72b13887 KCC: move console colours from kcc_utils to graph_utils
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
c33761d9be KCC: pep8 for ldif_utils.py
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:26 +02:00
Douglas Bagnall
070c9f7094 KCC: move ldif import/export functions into their own module
They might be of use elsewhere, and they are easily separable from the
KCC core.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00
Douglas Bagnall
e753d11e4d KCC: rearrange samba_kcc entry point
For locality, so that it becomes clearer which variables are used
where.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00
Douglas Bagnall
edd4aa2d47 KCC graph_utils: rename KCCGraphError, GraphError
In case it gets used elsewhere.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00
Douglas Bagnall
222b8221d3 KCC: try graphing edges in colour for partition type
It doesn't add much.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00
Douglas Bagnall
195b9f4c79 KCC: shift graph plotting and verification into a separate module
These might possibly be useful outside the KCC context, and the don't
rely on the rest of kcc_utils.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00
Douglas Bagnall
d383cd6f5e KCC: improved documentation for verify_graph_directed_double_ring
The actual function is still somewhat broken.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-05-29 06:58:25 +02:00