1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

35 Commits

Author SHA1 Message Date
Martin Schwenke
7fcfea6141 IP allocation simulation - Pad IPv4 addresses in LCP2 algorithm.
This makes IPv4 addresses comparable with IPv6 but reduces the overall
effectiveness of the algorithm.  The alternative would be to treat
these addresses separately while trying to keep all the IPs in overall
balance...  which is basically the problem that LCP2 solves.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3a7624f9d468b99714a7b6a45313f9e7f66011ed)
2011-07-29 14:32:07 +10:00
Martin Schwenke
0a96e936f2 IP allocation simulation - make stats label for LCP2 imbalance more meaningful.
This time in the stats summary.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit aabb2507dacc63ae026e6c99704a2fb79950e82c)
2011-07-29 14:32:07 +10:00
Martin Schwenke
581375d56d IP allocation simulation - make stats label for LCP2 imbalance more meaningful.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 721a06e28bacf9e03fd8eb4aff53dd17c363ffa1)
2011-07-29 14:32:07 +10:00
Martin Schwenke
adf8dbe8c0 IP allocation simulation - add examples.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8a1ae0c5a3aa788ed0f29c264249ba7bc5d226a7)
2011-07-29 14:32:07 +10:00
Martin Schwenke
85c0b10a38 IP allocation simulation - tighten up termination condition for -x.
When there are IP groups, do not terminate when the overall cluster
goes out of balance.

Also make explicit that grat_ip_moves is an integer not a boolean, so
only terminate if it is greater than 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0899f14b1483682d73d1ee2d2419db54ffeadc4b)
2011-07-29 14:32:07 +10:00
Martin Schwenke
d2ec92ba71 IP allocation simulation - fix documentation for diff() function.
It had out-of-date information and a typo.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5d0d2b8b528414c859da0e6fd5959321db33608b)
2011-07-29 14:32:07 +10:00
Martin Schwenke
c84310e512 IP allocation simulation - add mean imbalance statistics.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b541194d6075e5db72fb691fb79dc81659771cb1)
2011-07-29 14:32:07 +10:00
Martin Schwenke
9f8a781ff1 IP allocation simulation - add -A/--aggressive option.
This is likely to cause many more state changes for nodes.  In this
mode the odds of a failover are applied to determine whether a state
change occurs for each node.  If no state change occurs then the
process is repeated.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b7c42bff9457ec8294b04245af8e3b6010707d1a)
2011-07-29 14:32:07 +10:00
Martin Schwenke
0829e1a22b IP allocation simulation - add LCP2 imbalance metric to node state output.
Print the LCP imbalance metric after the list of IPs.

To make this more sensible, but most of the printing logic into the
Node class.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 2e680e6b421d72cf2d217d3c3c1564da0bb19633)
2011-07-29 14:32:07 +10:00
Martin Schwenke
04196c78c7 IP allocation simulation - add analysis of IP groups.
The public addresses passed to the node constructer can be nested 2
levels.  Each sub-list is an IP group for which separate balance
analysis is done.  However, the public address list is flattened and
the actual IP assignment algorithm doesn't know about IP groups.

This allows extra statistics to be printed and an extra termination
condition to be added for unbalanced IP groups.

Most code from calculate_imbalance() is factored out to a a new
function imbalance_for_ips(), which calculates imbalance for the given
IPs.  calculate_imbalance() now returns the overall imbalance and a
list containing imbalances for each IP group.  To support this
node_ip_coverage() now takes an optional list of IPs to check coverage
within.

This also adds extra output to show statistics for the LCP2 imbalance
metric.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 701395087156b2a5c7be1564897b796df35b69ec)
2011-07-29 14:32:07 +10:00
Martin Schwenke
43e9a7b6c4 IP allocation simulation - add -H/-S options for hard/soft imbalance limit.
An imbalance exceeding the hard limit, as specified by -H (and
defaulting to 1), now causes termination when -x is specified.

Imbalances exceeding the soft limit, as specified by -S (and
defaulting to 1), are counted and printed in the statistics summary.

A side-effect is that imbalances less than 2 are no longer rounded
down to 0, since we want to see them in the stats.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b5e9a4c50eedb8cc786c52af06352788ca25f51e)
2011-07-29 14:32:07 +10:00
Martin Schwenke
2acf892e6e IP allocation simulation - add LCP2 algorithm.
Add -L/--lcp2 option and implement LCP2 algorithm as an alternative to
the basic non-deterministic algorithm.

Existing examples will break if used with LCP2 since it needs real IP
addresses.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 22b14e1a887f0479cc75ed9027af5cc24797f217)
2011-07-29 14:32:07 +10:00
Martin Schwenke
c3bdf4a0a1 IP allocation simulation - options.exit is boolean, so don't compare with 0.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 68a49739763b7125382186504b9cb9b770cfde0e)
2011-07-29 14:32:07 +10:00
Martin Schwenke
cec93a2ffe IP allocation simulation - remove unused function find_least_loaded_node().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4ff3b73b1ccb795fac98b26e038f41f5e32f0d6b)
2011-07-29 14:32:07 +10:00
Martin Schwenke
fb385a2043 IP reallocation simulation - remove --hack option.
The hacks were attempts at improving the deterministic IPs algorithm
but they didn't work.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 6034de0e24438e012f9f1d2065531b1ce467ac52)
2011-07-29 14:32:07 +10:00
Martin Schwenke
540c2cbcfd IP allocation simulation - add debug output using -vv.
-v can now be provided more than once to increase verbosity.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ce4fb56c9972a854bd139429b6f4a26e8d5c3956)
2011-07-29 14:32:07 +10:00
Martin Schwenke
807567e992 Testing: IP allocation simulation - add option to change odds of a failure.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b2a2e301025d7fbfe5eeaac436693cde6d404490)
2010-08-03 11:51:14 +10:00
Martin Schwenke
4ffb6495ff Testing: IP allocation simulation - clean up usage message.
Group options better and make the language consistent between options.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bc38c17e4115fae00c89d00537fdcfe621111b37)
2010-08-03 11:41:50 +10:00
Martin Schwenke
4728bf6ece Testing: IP allocation simulation - print maximum number of unhealthy nodes.
This can imply something about imbalance.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ecb80e2b6be9326708d1fc87ad3028c6836d5858)
2010-08-03 11:37:34 +10:00
Martin Schwenke
8ca925fe5d Testing: IP allocation simulation - improve help for options.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 058501b92f602e7d2240d1cb08ed78a807564c48)
2010-08-03 11:36:33 +10:00
Martin Schwenke
8cc6ed1d0e Testing: IP allocation simulation - make usage/failure more obvious.
Tweak the usage message for -g option.

Print an error if no node groups defined, instead of curious Python
error.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8b883eb9346b8278d268e35b56ac680cd9526b97)
2010-08-02 15:46:23 +10:00
Martin Schwenke
326514f152 Testing: IP allocation simulation - rename an example to node_group_extra.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 974f849df0aca2cfedb38fa815894955e32803a8)
2010-08-02 15:09:13 +10:00
Martin Schwenke
d438b2398f Testing: IP allocation simulation - rename an example to node_group_simple.py.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0a2a5602233a8208e2729192e50d816faed0151a)
2010-08-02 15:07:56 +10:00
Martin Schwenke
4af049780a Testing: IP allocation simulation - add general node group example.
This allows node pool configuration to be specifed on the
command-line.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d382d9023928f75f360a115ae1e9c1036423416e)
2010-08-02 15:06:39 +10:00
Martin Schwenke
0fdd7566c7 Testing: IP allocation simulation - update options processing in examples.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a65ca1a71386f40080dd553756f3600d3b20d523)
2010-08-02 15:01:47 +10:00
Martin Schwenke
ecdbd99557 Testing: IP allocation simulation - Update README.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ed64b7f2b3cd920bb0f5dfd7f64ed0afc0b99fc1)
2010-08-02 14:58:15 +10:00
Martin Schwenke
ae0f339173 Testing: IP allocation simulation - fix nondeterminism in do_something_random().
The current code makes random choices from unsorted lists.  This
ensures the lists are sorted.

Also, make the code easier to read by doing the random selction from
lists of PNNs rather than lists of Node objects.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a01244499dc3567f5aa934b1864b9bc183a6c242)
2010-08-02 14:24:00 +10:00
Martin Schwenke
eac5edf322 Testing: IP allocation simulation - Tweak options handling and Cluster.diff().
process_args() must now be called by programs inporting this module.
Options are put into global variable "options", which can be
references using "ctdb_takeover.options".

Can now pass extra option specifications to process_args().

Remove global variable prev and make it a Cluster object variable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a32298e7bc819694518e859f100f9444ff5663cd)
2010-08-02 14:20:12 +10:00
Martin Schwenke
ef77f613fa Testing: IP allocation simulation - update copyright message.
There's a lot of new code here, so let's make the copyright message
make sense.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e6e56e5989def6704b116e806c1f261c7f3fc03f)
2010-08-02 14:16:02 +10:00
Martin Schwenke
de4223fa54 Testing: IP allocation simulation - add command line option for random seed.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 8362029c7cfc1041e46ee2116aa5cade6edce435)
2010-08-01 11:53:28 +10:00
Martin Schwenke
2e570851d5 Testing: IP allocation simulation - save some warnings for verbose mode.
We don't need to see warnings about unallocatable IPs unless we're in
verbose mode.  Can node be run with -n (and without -v or -d) to see
just the statistics.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 55370936ac5def5ebf138910388a2ddc2df9c20f)
2010-08-01 11:41:52 +10:00
Martin Schwenke
d7d2c64834 Testing: IP allocation simulation prints final imbalance in statistics.
This is useful to know.  When things get unbalance they tend to stay
that way.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a40faa2096effc2657ac05b729f3259bbb2e1fed)
2010-08-01 11:41:02 +10:00
Martin Schwenke
d7e996915c Testing: In IP allocation simulation count total number of events.
This starts at -1 because we always have to do the initial allocation.

No longer print event number for each event by default, only when
verbose is enabled.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c9a761726d141bcaa8ba7851150f71a8130b473a)
2010-08-01 11:39:30 +10:00
Martin Schwenke
88337cb080 Testing: Add imbalance information to IP allocation simulation.
Implement the imbalance calculations.

Also add command-line option to display imbalance for each step.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f50a12f6d06ed67efadd2a892d62c01e67310e7d)
2010-08-01 11:37:35 +10:00
Martin Schwenke
7c939e5fbf Testing: Add Python IP allocation simulation.
Includes simulation module and example scenarios.  This allows you to
test and perhaps tweak an algorithm that should be the same as the
current CTDB IP reallocation one.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 10e701fa9bba2a166c947a5a18f231ff64d9b861)
2010-07-30 16:45:36 +10:00