1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
Commit Graph

4603 Commits

Author SHA1 Message Date
Amitay Isaacs
09679d441b git: Ignore generated ctdb.spec file
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ca7ba26362eabfbcc329c66919d9c4da79c3b799)
2013-05-29 16:24:04 +10:00
Amitay Isaacs
55d2772ec0 git: Ignore ctdb_version.h file
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 641f539ffc7dd9542e669a3ec20c004f8bbcbf1e)
2013-05-29 16:24:04 +10:00
Amitay Isaacs
7c5252e453 build: Use REPLACE_OBJ and CTDB_EXTERNAL_OBJ to simplify build rules
This fixes the build on AIX where libreplace is required to build
ctdb_lock_helper, ctdb_fetch_lock_once, ctdb_fetch_readonly_once.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit fa757b49374e44c2380d4457e9b0eb3582981fac)
2013-05-29 16:23:49 +10:00
Amitay Isaacs
93ac364e23 build: Support for building on AIX xlc compiler
xlc does not support -fPIC, -Wno-format-zero-length

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2cf95741fdab2ee5f724950a0b1ef257d6aeade7)
2013-05-29 15:17:45 +10:00
Amitay Isaacs
0add37aca7 tests: Do not use err() to support AIX
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 1734562a7b3512853b9e0232880c42d50c1c2e4c)
2013-05-29 15:17:45 +10:00
Amitay Isaacs
4069ccf22f tests: Include system/time.h to support building on AIX
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0320bb4f8ca8171812ec7f41556aed847c74bfb4)
2013-05-29 15:17:20 +10:00
Amitay Isaacs
6635092a76 libctdb: Do not include sys/time.h to support build on AIX
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2c19fa78ce0b25c3615b23664df32233bdbdea42)
2013-05-29 15:16:54 +10:00
Amitay Isaacs
e6208ea453 util: Do not stop build if backtracing is not supported
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit b091f09ea01482823bd850d1d4e2329e0a19c959)
2013-05-29 14:57:03 +10:00
Martin Schwenke
2e515f2306 eventscripts: Fix statd-callout update handling
60.nfs and 60.ganesha touch $statd_update_trigger every time they're
run.  This stops the statd-callout updates from ever being called.

Make this logic self-contained and move it to new function
nfs_statd_update() in the functions file.  Call this in 60.nfs and
60.ganesha with the appropriate update period as the only argument.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reported-by: Poornima Gupte <poornima.gupte@in.ibm.com>

(This used to be ctdb commit 1b5968f6be084590667f4f15ff3bef13ed9a2973)
2013-05-28 16:11:47 +10:00
Martin Schwenke
529db4d52c tests/integration: Improve debug output for unhealthy cluster after restart
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 25a6fd784cde96f3d20a79f70b5589b5c4aca675)
2013-05-28 14:24:16 +10:00
Martin Schwenke
7dca442057 tests/scripts: Delete unused $rows and $ww variables from run_tests
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 80b3cf2c652c6098390cdd0dbb3edc648f7df487)
2013-05-28 14:24:16 +10:00
Martin Schwenke
7adf52e6b3 packaging: Create separate package for pcp pmda
To build ctdb-pcp-pmda package, run packaging/RPM/makerpms.sh script with
"--with pmda" option.

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

(This used to be ctdb commit 85e11b9b13b3add88c1b8957be51793cc1db4f2d)
2013-05-28 14:24:16 +10:00
Martin Schwenke
4a1eed5043 build: Separate autoconf macros for pmda
The pmda stuff is no longer built by default even if the headers are
available.  To build, run "configure --enable-pmda".

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

(This used to be ctdb commit 194f7a0dec26d693a5f3e6734b1c82f61f8e4d19)
2013-05-28 14:24:16 +10:00
Martin Schwenke
982ea336db build: Fix install paths for pcp pmda
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 11af486754bb04899e3dc544157bf70530e66cd1)
2013-05-28 14:24:16 +10:00
Martin Schwenke
2d3d5c133e packaging: makerpms.sh can take multiple arguments for rpmbuild
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f2ef3510407fbad29908195c58e4160d5a81e8a4)
2013-05-27 15:15:25 +10:00
Martin Schwenke
1eab9c898c eventscripts: Stop NAT gateway's delete_all() from polluting the log
Every time a node that wasn't the NAT gateway master gets reconfigured
something like this appears in the log:

  ctdbd: 11.natgw: Failed to del 10.0.1.139 on dev eth1

Since this usually fails it is better to mute the error than to have
it pollute the log.

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

(This used to be ctdb commit 0ca7a98ffef50cbd06849cfbf65fb4a3d668b7bd)
2013-05-27 15:15:25 +10:00
Martin Schwenke
1ab2bbb349 recoverd: Backward compatibility for nodes without IPREALLOCATED control
Consider the case of upgrading a cluster node by node, where some
nodes are still running older versions of CTDB without the
IPREALLOCATED control.  If a "new" node takes over as recovery master
and a failover occurs, then it will attempt to send IPREALLOCATED
controls to all nodes.  The "old" nodes will fail in a fairly
nondescript way (result == -1).

To try to handle this situation, fall back to the EVENTSCRIPT control
to handle "ipreallocated".  Only do this on the failed nodes.
However, do not do this on nodes that timed out (they've probably
implemented the control and we should call the regular fail_callback
to get those nodes banned) or for stopped nodes (since they can't
actually run the "ipreallocated" event via the EVENTSCRIPT control).

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

(This used to be ctdb commit b2654853ce9b7c18c5874b080bc94d3118078a5d)
2013-05-27 15:15:25 +10:00
Martin Schwenke
66019e3287 scripts: Provide mktemp function for platforms without mktemp command
This is needed for AIX and possibly others.

Also provide a cheaper mktemp function is needed in the run_tests
script.

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

(This used to be ctdb commit b2b572e9049c7138bd223226475bef8fe3e01f10)
2013-05-27 15:14:33 +10:00
Martin Schwenke
17d7288440 tests: Fix integration tests to use real private IPs
192.0.2.x was a typo.

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

(This used to be ctdb commit c9e36f596c63c9af7f80d7cb8d7a5c6dcca4860a)
2013-05-27 12:23:43 +10:00
David Disseldorp
50bae99ac6 pmda: handle new ctdb_statistics format
The ctdb_statistics structure was recently changed. Update the PMDA to
dereference the new structure member names.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit e5a5ab53173d9aa4190ddf68c4ae316d4473eb56)
2013-05-26 23:54:47 +02: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
a87ebb6cdf tests/takeover: Takeover tests can use up to 1024 and checks limits
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit cfd1371d3a1f78a0ed86485d83bd4d311727c3d4)
2013-05-24 22:31:21 +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
Amitay Isaacs
a002c6ec12 vacuum: Reduce the priority of non-critical error
Since the complete database is not locked when the receive_records
control is received, it's possible that we may not be able to obtain
lock on a chain.  We will try again to store this record.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 32723c9efdad1c6ca4aa53f308ccd9bef1aadfff)
2013-05-24 14:22:16 +02:00
Michael Adam
d1dd29197e ctdbd: fix comment explaining redirection of CTDB_REQ_CALL redirection.
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit b697625b184227dad1be31a41b7a3fd9bd312e29)
2013-05-24 22:06:24 +10:00
Michael Adam
3f03a3c8a3 ctdbd: remove a nonempty blank line
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit d9e24782a90d9ce29c0e6584b75d2b186142174d)
2013-05-24 22:06:21 +10:00
Michael Adam
a0b20771fe ctdbd: update comment describing ctdb_call_send_redirect()
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 9a21d417c51fb9cad8f2e87e00ca54d379aef860)
2013-05-24 22:06:16 +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
f35e9bba9b recoverd: Nodes can only takeover IPs if they are in runstate RUNNING
Currently the order of the first IP allocation, including the first
"ipreallocated" event, and the "startup" event is undefined.  Both of
these events can (re)start services.

This stops IPs being hosted before the "startup" event has completed.

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

(This used to be ctdb commit f15dd562fd8c08cafd957ce9509102db7eb49668)
2013-05-24 16:27:55 +10:00
Martin Schwenke
7f03618ae4 recoverd: Handle errors carefully when fetching tunables
If a tunable is not implemented on a remote node then this should not
be fatal.  In this case the takeover run can continue using benign
defaults for the tunables.

However, timeouts and any unexpected errors should be fatal.  These
should abort the takeover run because they can lead to unexpected IP
movements.

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

(This used to be ctdb commit c0c27762ea728ed86405b29c642ba9e43200f4ae)
2013-05-24 16:27:55 +10:00
Martin Schwenke
116f62a7b3 recoverd: Set explicit default value when getting tunable from nodes
Both of the current defaults are implicitly 0.  It is better to make
the defaults obvious.

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

(This used to be ctdb commit 1190bb0d9c14dc5889c2df56f6c8986db23d81a1)
2013-05-24 16:04:57 +10:00
Martin Schwenke
28d608556d client: async_callback() sets result to -ETIME if a control times out
Otherwise there is no way of treating a timeout differently to a
general failure.

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

(This used to be ctdb commit 40e34773b8063196457746ffe7a048eb87d96d61)
2013-05-24 16:04:56 +10:00
Martin Schwenke
140f0cfd3b ctdbd: Update the get_tunable code to return -EINVAL for unknown tunable
Otherwise callers can't tell the difference between some other failure
(e.g. memory allocation failure) and an unknown tunable.

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

(This used to be ctdb commit 03fd90d41f9cd9b8c42dc6b8b8d46ae19101a544)
2013-05-24 16:04:50 +10:00
Martin Schwenke
e78b064dcc recoverd: Whitespace improvements
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 473cfcb019f0cb4a094bf10397f7414f7923ee57)
2013-05-24 15:55:11 +10:00
Martin Schwenke
1a181a4284 recoverd: Use talloc_array_length() for simpler code
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f6792f478197774d2f3b2258c969b67c83e017ab)
2013-05-24 15:55:10 +10:00
Martin Schwenke
94b0e8dfeb ctdbd: When the "setup" event fails log an error and exit, don't abort
The "setup" event can fail when one of the eventscripts fails to run
its "setup" event.  If this occurs then the eventscript should log an
error.  The stack trace and core file generated when we abort provides
no useful information.

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

(This used to be ctdb commit c50eca6fbf49a6c7bf50905334704f8d2d3237d7)
2013-05-24 14:08:07 +10:00
Martin Schwenke
a989a299d1 eventscripts: 11.natgw should not call ctdb tool in "init" event
The current code calls "ctdb setnatgwstate ..." on every event.
However, calling the ctdb tool in the "init" event is not permitted.

Instead, update the capability when it is needed and at regular
intervals via the "monitor" event.

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

(This used to be ctdb commit 39a43feae7c7de07ddaf2d6cb962f923d47d0c19)
2013-05-24 14:08:07 +10:00
Martin Schwenke
6d9667f01c ctdbd: Add new runstate CTDB_RUNSTATE_FIRST_RECOVERY
This adds more serialisation to the startup, ensuring that the
"startup" event runs after everything to do with the first recovery
(including the "recovered" event).

Given that it now takes longer to get to the "startup" state, the
initscript needs to wait until ctdbd gets to "first_recovery".

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

(This used to be ctdb commit ed6814ff0a59ddbb1c1b3128b505380f60d7aeb7)
2013-05-24 14:08:07 +10:00
Martin Schwenke
b5ebff6931 tools/ctdb: "ctdb runstate" now accepts optional expected run state arguments
If one or more run states are specified then "ctdb runstate" succeeds
only if ctdbd is in one of those run states.

At the moment, if the "setup" event fails then the initscript succeeds
but ctdbd exits almost immediately.  This behaviour isn't very
friendly.

The initscript now waits until ctdbd is in "startup" or "running" run
state via the use of "ctdb runstate startup running", meaning that ctdbd
has successfully passed the "setup" event.

The "setup" event code in 00.ctdb now waits until ctdbd is in the
"setup" run state before proceeding via the use of "ctdb runstate setup".

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

(This used to be ctdb commit 4a2effcc455be67ff4a779a59ca81ba584312cd6)
2013-05-24 14:08:07 +10:00
Martin Schwenke
87eb70180a tools/ctdb: New command runstate to print current runstate
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit bf20c3ab090f75f59097b36186347cedb1c445d4)
2013-05-24 14:08:07 +10:00
Martin Schwenke
77671b9ef5 ctdbd: New control CTDB_CONTROL_GET_RUNSTATE
Also new client function ctdb_ctrl_get_runstate().

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

(This used to be ctdb commit dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1)
2013-05-24 14:08:07 +10:00
Martin Schwenke
147f6bb4b8 ctdbd: Start logging process earlier
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f43fe3a560d5915c1a9893256f4e7bfe3d7e290a)
2013-05-24 14:08:07 +10:00
Martin Schwenke
0e678a73b8 ctdbd: Only start recovery daemon and timed events after setup event
This deconstructs ctdb_start_transport(), which did much more than
starting the transport.

This removes a very unlikely race and adds some clarity.  The setup
event is supposed to set the tunables before the first recovery.
However, there was nothing stopping the first recovery from starting
before the setup event had completed.

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

(This used to be ctdb commit c31feb27dcdb748b5333321c85fe54852dfa1bcf)
2013-05-24 14:08:06 +10:00
Martin Schwenke
63577c96db ctdbd: Replace ctdb->done_startup with ctdb->runstate
This allows states, including startup and shutdown states, to be
clearly tracked.  This doesn't include regular runtime "states", which
are handled by node flags.

Introduce new functions ctdb_set_runstate(), runstate_to_string() and
runstate_from_string().

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

(This used to be ctdb commit 8076773a9924dcf8aff16f7d96b2b9ac383ecc28)
2013-05-24 14:08:06 +10:00
Martin Schwenke
c5bcff6724 tools/ctdb: Remove duplicate command definition for "sync"
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 9e7b7cd04adc5e66e2ffa4edf463a682aaea379b)
2013-05-24 14:08:06 +10:00
Amitay Isaacs
03a96f280f logging: Make sure ringbuffer messages are terminated with a newline
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit dbb7c550133c92292a7212bdcaaa79f399b0919b)
2013-05-24 09:15:08 +10:00
Amitay Isaacs
e6673f2c46 tests: Fix output of run_tests usage
(This used to be ctdb commit 29911fa44a480c17c701528ef46919b2a962a366)
2013-05-24 09:06:40 +10:00
Amitay Isaacs
c8d577eb80 locking: Set lock helper path once
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 80fbe9364350d42658f7f8af250ac87eb1afbc21)
2013-05-24 09:06:40 +10:00
Amitay Isaacs
1ddc7b0d10 locking: Remove functions that are not used anymore
These functions were used in locking child process to do the locking.  With
locking helper, these are not required.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c660f33c3eaa1b4a2c4e951c1982979e57374ed4)
2013-05-24 09:06:40 +10:00
Amitay Isaacs
90c4fa77b9 locking: Remove functions that are not used anymore
These functions were used in locking child process to do the locking.  With
locking helper, these are not required.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 6ea3212a7b177c6c06b1484cf9e8b2f4036653d9)
2013-05-24 09:06:40 +10:00
Amitay Isaacs
ae25420e56 locking: Use separate locking helper binary for locking
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7cde53a6cbe74b1e46f7e1bca298df82c08de866)
2013-05-24 09:06:40 +10:00
Amitay Isaacs
e30978eae1 locking: Create commandline arguments for locking helper
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f665e3d540c90579952e590caa5828acb581ae61)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
30aa825c1e locking: Add a standalone helper to lock record/db
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit a08b6ac19506160f3fb5925ea025027dce07781d)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
c9f4589c13 locking: Use database iterator for unmarking databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7630ca4116b476636c27407748088ea335f1a06c)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
65a9195916 locking: Add handler function for unmarking a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit adc113055de98fae276f9b501aff5c03cd25ddc8)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
a5133d16e7 locking: Use database iterator for marking databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit e8ea65b2713417db4a618a9f4633991cfaa93fe6)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
ed359bb1ea locking: Add handler function for marking a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f120e40533780e02ff1cdc41cc6d3af1c4c83258)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
c5c79d63f2 locking: Use database iterator for unlocking databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 187ed83f9701c7fa8d3cc476d47c5d2a87d5c308)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
b96388f95f locking: Add handler function for unlocking a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 725239535f40ca2cca445bb5bf2e181351b330e9)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
403b1eaa6e locking: Use database iterator for locking databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d2634d72d9ca0ceeb72cbb1adc95017a234480fd)
2013-05-24 09:06:39 +10:00
Amitay Isaacs
bd6ad3f817 locking: Add handler function for locking a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2a1c933ef7c78ee071e2a640ea10941f1c12e32a)
2013-05-24 09:06:38 +10:00
Amitay Isaacs
4581582a5e locking: Refactor code to iterate over databases based on priority
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit a3275854812aca86032704134fdf6a129069c86a)
2013-05-24 09:06:38 +10:00
Amitay Isaacs
0c9d72eb18 locking: Add newline to debug logs
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d98a861716d5f8c1f4387d21666396d3164551b3)
2013-05-24 09:06:38 +10:00
Amitay Isaacs
a0cfc381d3 tools/ctdb: Fix racy ipreallocate code
This code tried to find the recovery master and send an ipreallocate
request to that node.  When a node is stopped, this code asked the
stopped node for recovery master.  Stopped node does not have up-to-date
information on the current recovery master.  So ipreallocate requests
were sent to the wrong node and ignored by that node which is not the
recovery master.

Send ipreallocate request to all active nodes.  That way we guarantee
that the current recovery master will see it and respond to it.

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

(This used to be ctdb commit 0577ce3c68e4febf49a1ef5093e918db9d5ec636)
2013-05-23 16:19:20 +10:00
Amitay Isaacs
7ee9e22a09 ctdbd: Print version string in the daemon startup
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 9d4524d13cbba21bfaf61bd35667984359b379b3)
2013-05-23 16:18:23 +10:00
Amitay Isaacs
6d0c388e5c build: Rename version.h to ctdb_version.h
This avoids clash with version.h from Samba tree.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit d18fcfff674e876abde8d51afec92d9c4a090d2f)
2013-05-23 16:18:23 +10:00
Amitay Isaacs
5145b9bcec logging: Fix a bug in ringbuffer
When ringbuffer is full, it does not return any entries.  Simplify
ringbuffer logic by keeping track of number of log entries rather than
last entry.

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

(This used to be ctdb commit 939d12b96a0cbebbe6269fa2b14f584058dd6174)
2013-05-23 16:18:23 +10:00
Martin Schwenke
5fdf71b898 recoverd: takeover_run_core() should not use modified node flags
Modifying the node flags with IP-allocation-only flags is not
necessary.  It causes breakage if the flags are not cleared after use.
ctdb_takeover_run() no longer needs the general node flags - it only
needs the IP flags.

Instead of modifying the node flags in nodemap, construct a custom IP
flags list and have takeover_run_core() use that instead of node
flags.  As well as being safer, this makes the IP allocation code more
self contained and a little bit clearer.

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

(This used to be ctdb commit 14bd0b6961ef1294e9cba74ce875386b7dfbf446)
2013-05-23 16:18:23 +10:00
Martin Schwenke
3f37b4418e ctdbd: Update confusing log message
Inactive can also mean stopped.  To add information, just print the
flags instead.

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

(This used to be ctdb commit a8605f7e06076e7edf84e0cc160fd3d9ab5c4b64)
2013-05-23 16:18:23 +10:00
Martin Schwenke
ce145ab65e Packaging: maketarball.sh should be a bash script due to pushd use
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3105f9e291d0792199ac9e689f6d0e0a47ee4b0d)
2013-05-23 16:18:23 +10:00
Martin Schwenke
bb39f0a186 scripts: Rework notify.sh to use notify.d/ directory
This makes it easier to add notification handlers.

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

(This used to be ctdb commit d29e9a420b133088bf23a847c8d1dbce56c25eb0)
2013-05-23 16:18:23 +10:00
Martin Schwenke
5aeae9744e ctdbd: Log a message when recovery master changes
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 1f96ea08f9a39dfe537c9b957ac512c84dc76f91)
2013-05-23 16:17:18 +10:00
Martin Schwenke
e769f8575a ctdbd: Log add and delete of IPs
At the moment, when someone deletes all the IPs on a node, all we see
are the release IP messages and we have to guess why.

Some would argue that add/release are more significant than
take/release so they should be logged.

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

(This used to be ctdb commit 3c3df1d6afec7e3e721f9bcd4e8b8e008fd6e50b)
2013-05-22 14:24:22 +10:00
Martin Schwenke
0baefba368 ctdbd: Removed bogus comment in ctdb_find_iface()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4a8d90d0812a3242f58a2a0e2aa0f528f60f7013)
2013-05-22 14:24:21 +10:00
Martin Schwenke
51dbaecb54 eventscripts: Fix regression in _loadconfig()
fff88940f71058e4eefd65f50a6701389c005c17 introduced a regression.
Without $service_name set by default, the CTDB configuration is no
longer loaded when loadconfig() is called without any arguments.
That's bad.

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

(This used to be ctdb commit f1619a36c1beba11533052dc5728fa3adaa08870)
2013-05-22 14:24:21 +10:00
Martin Schwenke
ff9831f5b1 initscript: If CTDB doesn't become ready, print a message before killing
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit e6b6b793f61556c21e8daf34abf89ee7b388ecfb)
2013-05-22 14:24:21 +10:00
Christian Ambach
129c12a547 build: Create sudoers.d dir during make install
otherwise make install into non-standard prefix will fail

Signed-off-by: Christian Ambach <ambi@samba.org>

(This used to be ctdb commit 0c0752515b66661ffae24be5f138bd2fab4dec5c)
2013-05-20 19:47:35 +10:00
Amitay Isaacs
84bcb95952 eventscripts: Do not use bashism for string comparison
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit b0cae7d5a00ef3764bae187affc8e9a252f4b329)
2013-05-20 19:47:10 +10:00
Martin Schwenke
54e91df60d recoverd: Move IP flags into ctdb_takeover.c
These should never be seen outside the IP allocation code.

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

(This used to be ctdb commit e143abd16ccde2e0edfe103673d31a5fb06b6aef)
2013-05-09 12:55:42 +10:00
Martin Schwenke
50f19b5bd4 recoverd: Clear IP flags after IP allocation algorithm has run
If these flags are left set they will confuse other recovery daemon
code.

Factor the clearing code into new function clear_ipflags().

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

(This used to be ctdb commit 45c776958017ea7001f061842c9e0f60e4a25f23)
2013-05-09 12:55:42 +10:00
Martin Schwenke
530020d83b recoverd: Remove unused mask argument and initial mask calculation
This has been replaced by set_ipflags() and associated functionality.

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

(This used to be ctdb commit d0a3822573db296e73cc897835f783c8abc084b3)
2013-05-07 16:20:47 +10:00
Martin Schwenke
ee7357de51 recoverd: When calculating rebalance candidates don't consider flags
This is really a check to see if a node is already hosting IPs.  If
so, we assume it was previously healthy so it isn't considered as a
rebalance candidate.  There's no need to limit this to healthy node,
since this is checked elsewhere.

Due to this the variable newly_healthy is renamed everywhere to
rebalance_candidates.

The mask argument is now completely unused.

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

(This used to be ctdb commit 65e0ea6c2c0629e19349ba4b9affa221fde2b070)
2013-05-07 16:20:47 +10:00
Martin Schwenke
c9056b4f88 recoverd: Remove unused mask argument from IP allocation functions
This is a no-op and is in a separate commit to make the previous
commit less cumbersome.

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

(This used to be ctdb commit 107e656bbe24f9d21fbaf886a3e9417da4effe5a)
2013-05-07 16:20:47 +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
ac80824709 recoverd: Factor out new function all_nodes_are_disabled()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 12aef10e9889760d98f58c8d916f19d069fa381a)
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
657162fb34 recoverd: Refactor code to get NoIPTakeover tunable from all nodes
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 1fb5352d2b6918fcc6f630db49275d25a3eebe8d)
2013-05-07 16:20:46 +10:00
Martin Schwenke
b416376e68 tests: Unit test diff output should use filtered output
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9721aae001b3023e9c8b4af2b143c0db3442d623)
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
de84c1fd3c eventscripts: NFS RPC checks no longer support "knfsd"
No longer used, support removed from test infrastructure.

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

(This used to be ctdb commit 0eb351ff4c7ee096de7c5e0a59561067091fa32e)
2013-05-07 12:55:09 +10:00
Martin Schwenke
434f9e8594 eventscripts: 60.nfs uses nfs_check_rpc_services() to check NFS RPC services
* New directory nfs-rpc-checks.d/ replaces hardcoded rules in 60.nfs

* Installation and packaging additions to handle nfs-rpc-checks.d/

* Unit test updates, including deleting 1 test that sanity checked
  test infrastructure

* Test infrastructure changes to use nfs-rpc-checks.d/

Note that this removes support for $CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK in
60.nfs.  To get the equivalent behaviour, edit 20.nfsd.check and
remove/comment all lines.

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

(This used to be ctdb commit 7e792d6768d9ca420ce3713cb122e63afd594b15)
2013-05-07 12:55:09 +10:00
Martin Schwenke
05b2edeec2 eventscripts: NFS RPC checks allows "nfsd" in addition to "knfsd"
Want nfs_check_rpc_services() to support filenames without the 'k'.

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

(This used to be ctdb commit d9775fcbd6e30eef8382bea68e2f9bad2309f2c1)
2013-05-06 20:40:58 +10:00
Martin Schwenke
c52183c055 eventscripts: New function nfs_check_rpc_services()
This is intended to replace nfs_check_rpc_service(), which builds
configuration into eventscripts.

nfs_check_rpc_services() uses a directory of configuration checks that
can be edited by an administrator.  The files have one limit check and
a set of actions per line.  The program name is extracted from the
file name.

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

(This used to be ctdb commit 9bc8fbee6550ed2814fb35c70d57fab21ef1b8fd)
2013-05-06 20:40:58 +10:00
Martin Schwenke
167acd1cd5 eventscripts: nfs_check_rpc_action() should be _nfs_check_rpc_action()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5a717fd495ba5a2bfd481d69f38b68fa4576716f)
2013-05-06 20:40:58 +10:00
Martin Schwenke
bdab9d1ea6 eventscripts: Factor out common code from nfs_check_rpc_service()
This creates new function _nfs_check_rpc_common().

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

(This used to be ctdb commit cc3bb42e48bbdabd19187c231846b98589b4f4f3)
2013-05-06 20:40:58 +10:00
Martin Schwenke
910e138cb3 eventscripts: Remove ganesha support from nfs_check_rpc_service()
This is unused so doesn't need to be maintained.  An attempt to use it
now will explicitly fail rather than implicitly fail via bitrot.

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

(This used to be ctdb commit 887733dd7be53158bfe07b30ef31b611d0f8122f)
2013-05-06 20:40:58 +10:00
Martin Schwenke
944d063a3e Revert "Eventscript functions: add optional version to nfs_check_rpc_service()"
This reverts commit 92f74fd589467b46c758e116e97417edfe8773d7.

This change is unused and is just complicating the function.

Conflicts:
	config/functions

(This used to be ctdb commit 77302dbfd85754e02559eccb2dd6c090db0b6b9f)
2013-05-06 20:40:58 +10:00
Martin Schwenke
577a3cae5d eventscripts: Move rpc.statd existence check into nfs_check_rpc_service ()
The code in 60.nfs is going to be genericised, so make all the checks
look the same.

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

(This used to be ctdb commit 15b0f78cbf8d6ba481b7eba9e4fe3f4270214c72)
2013-05-06 20:40:58 +10:00