1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

77 Commits

Author SHA1 Message Date
Martin Schwenke
d0739b2ea8 ctdb-daemon: Change default for tunable NoIPHostOnAllDisabled to 1
Defaulting to host public IP addresses when all nodes are unhealthy
does not obey the principle of least surprise.  It has caused much
confusion over the years.  It often leads to problems when all nodes
are unhealthy due to something like a cluster filesystem being
unmounted.

Change the default value for this tunable as the first step of
completely removing this behaviour.

Remove tests that set NoIPHostOnAllDisabled=1 and update the expected
result for other tests where no nodes are healthy.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:37 +02:00
Martin Schwenke
d0381a3cf4 ctdb-tests: Add a big no-op LCP2 IP takeover test
Although this tests correctness it is most useful for testing that
changes to IP takeover algorithm do not cause obvious performance
regressions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Aug 10 10:30:58 CEST 2017 on sn-devel-144
2017-08-10 10:30:58 +02:00
Martin Schwenke
58296e3eae ctdb-tests: Populate per-node known IPs inline
At the moment this is done as a post-processing step for any nodes
that have no known IPs.  However, this doesn't allow testing of
scenarios where there no known IPs on one or more nodes.

Add relevant tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-02-24 07:47:11 +01:00
Martin Schwenke
59dc07ee4a ctdb-tests: Remove the python LCP2 simulation
It isn't used anywhere and doesn't contain some of the optimisations
that have since gone into the C code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Dec 19 07:58:45 CET 2016 on sn-devel-144
2016-12-19 07:58:45 +01:00
Martin Schwenke
3d80fdd580 ctdb-takeover: NoIPHostOnAllDisabled is global across cluster
Instead of gathering the value from all nodes, just use the value on
the recovery master and have it affect all nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:08 +01:00
Martin Schwenke
9b456bc730 ctdb-takeover: NoIPTakeover is global across cluster
Instead of gathering the value from all nodes, just use the value on
the recovery master and have it affect all nodes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:08 +01:00
Martin Schwenke
3a395b67a3 ctdb-tests: Use symbolic debug levels in takeover tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-05 08:09:22 +01:00
Martin Schwenke
7d5a81e561 ctdb-tests: Allow takeover tests to be run under valgrind
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-04 15:42:26 +02:00
Martin Schwenke
821aa24ffd ctdb-ipalloc: Rename ctdb_takeover_run_core() to ipalloc()
It just does IP allocation...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-12-04 09:17:17 +01:00
Amitay Isaacs
17b77a99ae ctdb-tests: Refactor code using simple test harness functions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-07-09 06:23:21 +02:00
Amitay Isaacs
13770f7410 ctdb-tests: Remove extra_header and extra_footer variables
This is now achieved by defining functions extra_header() and
extra_footer().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-07-09 06:23:21 +02:00
Martin Schwenke
1c8c0be6f9 ctdb-tests: Make the fake log timestamp string easy to modify
Use a variable to allow easy change of this string in case future
logging changes modify the timestamp format or do not support
timestamping.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-10-06 12:34:32 +02:00
Martin Schwenke
d011e70215 ctdb-tests: Add another LCP2 takeover test
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-29 07:38:13 +02:00
Martin Schwenke
f1a20d748f ctdb-recoverd: Fix a bug in the LCP2 rebalancing code
srcimbl gets changed on every iteration of the loop.  The value that
should be stored for the new imbalance of the source node is
minsrcimbl.

To help diagnose this, added some extra debug that can be left in.

The extra debug changes the output of a couple of tests.  Note that
the resulting IP allocations in those tests is unchanged - only the
debug output is changed.

Also add some new tests that illustrates the bug.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-02-13 02:03:24 +01:00
Martin Schwenke
8ca117a68e ctdb:tests: Rework unit test result filtering
Using a variable is too fragile, so use a function instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-27 18:46:17 +01:00
Martin Schwenke
14ee82263c ctdb-tests/takeover: Fix bogus test description
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-27 18:46:16 +01:00
Martin Schwenke
2b971a2797 tests/takeover: New test with 900 IPs
(This used to be ctdb commit 75a620c516e384f042b5d675183b3a1b48fd6115)
2013-05-24 22:31:22 +10:00
Martin Schwenke
5009d1ab58 tests/takeover: LCP2 tests for weird, unbalanced corner-cases
2 tests to show a bad result and a 3rd test for the fix.

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

(This used to be ctdb commit ef35c8889d90220929e48e66eb62da9ea2025ede)
2013-05-24 22:31:21 +10:00
Martin Schwenke
b22dea5373 tests/takeover: Allow takeover runs with differing IP allocations per node
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 954ae6f84cb06a8dcbc12456d4752280072be5bf)
2013-05-24 22:31:21 +10:00
Martin Schwenke
c5bb401835 tests/takeover: New tests to check runstate handling
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c57430998a3bdedc8a904eb3a9cdfde1421aff50)
2013-05-24 16:27:55 +10:00
Martin Schwenke
b22ef16945 tests/takeover: Add takeover tests, mostly for NoIPHostOnAllDisabled
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7cf63722873a6a7baafd77aa3d8a1989b221dee9)
2013-05-07 16:20:46 +10:00
Martin Schwenke
0445c988e2 recoverd: Fix tunable NoIPTakeoverOnDisabled, rename to NoIPHostOnAllDisabled
This really needs to be per-node.  The rename is because nodes with
this tunable switched on should drop IPs if they become unhealthy (or
disabled in some other way).

* Add new flag NODE_FLAGS_NOIPHOST, only used in recovery daemon.

* Enhance set_ipflags_internal() and set_ipflags() to setup
  NODE_FLAGS_NOIPHOST depending on setting of NoIPHostOnAllDisabled
  and/or whether nodes are disabled/inactive.

* Replace can_node_servce_ip() with functions can_node_host_ip() and
  can_node_takeover_ip().  These functions are the only ones that need
  to look at NODE_FLAGS_NOIPTAKEOVER and NODE_FLAGS_NOIPHOST.  They
  can make the decision without looking at any other flags due to
  previous setup.

* Remove explicit flag checking in IP allocation functions (including
  unassign_unsuitable_ips()) and just call can_node_host_ip() and
  can_node_takeover_ip() as appropriate.

* Update test code to handle CTDB_SET_NoIPHostOnAllDisabled.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 1308a51f73f2e29ba4dbebb6111d9309a89732cc)
2013-05-07 16:20:46 +10:00
Martin Schwenke
5658e444dc tests/takeover: Allow per-node tunable settings
Implemented for CTDB_SET_NoIPTakeover.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit a1addd89fd9c0390912604097acd028cc24d3483)
2013-05-07 16:20:46 +10:00
Martin Schwenke
17521b31b2 recoverd: Add debug message when dropping IPs in IP allocation
Update tests accordingly.

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

(This used to be ctdb commit 91405282ba4abad4ad8e8c5f7ee4c83c75f38280)
2013-05-07 16:20:46 +10:00
Martin Schwenke
443fbb9e01 recoverd: Trying to failback more IPs no longer allocates unassigned IPs
Neither basic_failback() nor lcp2_failback() unassign IPs anymore, so
there's no point looping back that far.

Also fix a unit test that now fails because looping back to handle
unassigned IPs is no longer logged.

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

(This used to be ctdb commit c09aeaecad7d3232b1c07bab826b96818756f5e0)
2013-01-08 10:16:11 +11:00
Martin Schwenke
fdfc61a96d tests/takeover: Add some LCP2 tests for case when no node are healthy
3 tests should assign IPs to all nodes.

3 tests set NoIPTakeoverOnDisabled=1 and should drop all IPs.

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

(This used to be ctdb commit edda58a45915494027785608126b5da7c98fee85)
2013-01-08 10:16:11 +11:00
Martin Schwenke
565fc4ff46 tests/takeover: Initial tests for deterministic IPs
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5c820b2398a42af0e94bc524854a1ad144a63f7b)
2013-01-08 10:16:11 +11:00
Martin Schwenke
64a83fb72d tests/takeover: Do output filtering for deterministic IPs algorithm too
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 98bd58a98d34ecca89c9042417d7527a18a5ecf9)
2013-01-08 10:16:11 +11:00
Martin Schwenke
6c1b6c980e tests/takeover: IP allocation now selected via $CTDB_IP_ALGORITHM
Default to LCP2, like ctdbd.  Also support "det" for deterministic
IPs.

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

(This used to be ctdb commit 20631f5f29859920844dd8f410e24917aabd3dfd)
2013-01-08 10:16:11 +11:00
Martin Schwenke
c43da5d1c0 tests/takeover: Support valgrinding the takeover code
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 06ad6b8a19f830472b0ed65cb52e7c3ea74ed1dc)
2013-01-08 10:16:11 +11:00
Martin Schwenke
6764b7b33e tests: Update README files and add new README files where missing
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit bef03b32f8ec114a64c55b25951aeeb939d87b33)
2012-04-27 15:40:43 +10:00
Martin Schwenke
43f1209dc4 tests: Programs run by tests should be found in $PATH
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit b5308142d03332d6d4e0c3b77283c772462fbb23)
2012-04-27 15:40:43 +10:00
Martin Schwenke
116f19b808 tests: More unit test factoring/rationalisation and bug fixes
Move some options from eventscripts/run_tests.sh to scripts/run_tests.
Remove the former.

Move some functions from eventscripts/scripts/local.sh to
scripts/unit.sh.

Both of these are modified during move so they are no longer
eventscript-specific.

Tweak */local.sh so that the new functions in unit.sh are used.

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

(This used to be ctdb commit 7ff485687891732074c9fc9998502ca197663d02)
2012-04-18 10:37:45 +10:00
Martin Schwenke
76d75f8c81 tests/takeover - Restructure according to new convention
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f94897ef9504c144937409688fa7a646e0b0ceae)
2012-04-16 15:57:16 +10:00
Martin Schwenke
e5f5a101ee Tests - IP allocation - 2 tests for NODE_FLAGS_NOIPTAKEOVER
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit fa54a1095a7504863ed30bff8e0828a8be6dde55)
2012-04-16 14:57:44 +10:00
Martin Schwenke
39317325f5 Tests - IP allocation - add another LCP2 test based on a test failure
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 89e322562f25dcb8d84357a19e71b2272b2f29a8)
2012-04-16 14:57:44 +10:00
Martin Schwenke
c7c19397cd Test - IP allocation simulation - add -e option to run the daemon's algorithm
A recent change in the deamon's (i.e. real) IP allocation algorithm
uses qsort(3).  This makes it very difficult to get the same results
in Python, since qsort's behaviour on identical keys is undefined.

Add a -e option to run "../bin/ctdb_takeover_tests ctdb_takeover_run_core"
instead of the internal Python algorithm.  We pass the current cluster
state and read it back from the output of the test program.

This is currently a rough hack.  Perhaps it'll be improved later...
:-)

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

(This used to be ctdb commit eed3f4988290bbe317a7aaa6f61826676dd8365a)
2012-02-06 16:03:01 +11:00
Martin Schwenke
840a9b8702 Tests - IP allocation simulation - LCP2 => non-deterministic
The default in this script is still deterministic IPs.  The LCP2
option should really turn off deterministic IPs.

Also fix a typo...

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

(This used to be ctdb commit c378a059b35fcc9955215a0095826c919d42153c)
2012-02-06 16:03:01 +11:00
Martin Schwenke
cb21f178e3 Tests - IP allocation - add some extra output due to recent fix
A recent fix made the LCP2 algorithm try harder find a candidate
source node.  The debug output shows extra output because it is trying
harder so we accommodate that.

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

(This used to be ctdb commit 9a6f918bf6db79c1f8c53c0df23d47b73c117ea2)
2011-11-02 10:17:00 +11:00
Martin Schwenke
575f76788b Tests - IP allocation - new test that shows current LCP2 failure
There are 4 IPs across 2 nodes and 2 addresses across 2 other nodes.
If one of the latter nodes is unhealthy and then becomes healthy
again, an IP isn't failed back.  This is because the nodes in the 1st
group are >= unbalanced then the nodes in the 2nd group.

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

(This used to be ctdb commit 1d26e7cff6292fcbf63efc4628ffbb63b6f1f73c)
2011-11-01 21:01:25 +11:00
Martin Schwenke
695432c52f Tests - IP allocation tests - must export CTDB_LCP2.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a97f19d1281eaf9874e64995a43524aeed315515)
2011-11-01 21:01:25 +11:00
Martin Schwenke
155862ea21 Tests - IP allocation - initial unit tests
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3922225ddff90281189ebdab77620b560d233e04)
2011-09-25 14:45:48 +10:00
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