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

7087 Commits

Author SHA1 Message Date
Martin Schwenke
5e7ae1b1e2 ctdb-scripts: Initialise CTDB_NFS_CALLOUT in statd-callout
Some configurations may set CTDB_NFS_CALLOUT to the empty string.
They may do this if they allow a choice of NFS implementations.  In
this case the default call-out for Linux kernel NFS should be used.
However, statd-callout does not call nfs_callout_init() to set the
default.  Therefore, statd-callout is unable to restart the lock
manager, so the grace period is never entered.

statd-callout must call nfs_callout_init() before trying to restart
the lock manager.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12589

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Feb 16 09:21:03 CET 2017 on sn-devel-144
2017-02-16 09:21:03 +01:00
Amitay Isaacs
024a2c20d2 ctdb-tests: Add more comm tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12580

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-02-16 05:26:08 +01:00
Amitay Isaacs
9db7785fc6 ctdb-common: Fix use-after-free error in comm_fd_handler()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12580

comm_write_send() creates a new tevent_req and adds it to the queue
of requests to be processed.  If this tevent_req is freed, then the
queue entry is not removed causing use-after-free error.

If the tevent_req returned by comm_write_send() is freed, then that
request should be removed from the queue and any pending actions based
on that request should also be removed.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-02-16 05:26:08 +01:00
Volker Lendecke
02380ca3e7 ctdb: Only build test_mutex_raw.c on Linux
This is pretty glibc on Linux specific. FreeBSD 11 also has
robust mutexes and can't build this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-02-15 02:28:16 +01:00
Amitay Isaacs
ce9b72c17a ctdb-build: Install CTDB tests correctly from toplevel
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12547

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Feb  2 08:25:57 CET 2017 on sn-devel-144
2017-02-02 08:25:57 +01:00
Amitay Isaacs
2bea45e450 ctdb-common: ioctl(.. FIONREAD ..) returns an int value
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12549

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Feb  1 14:29:14 CET 2017 on sn-devel-144
2017-02-01 14:29:14 +01:00
Amitay Isaacs
39ac4ae65e ctdb-tests: Use replace headers instead of system headers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469

This ensures that PTHREAD_MUTEX_ROBUST, pthread_mutexattr_setrobust()
and pthread_mutex_consistent() are always defined.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan 31 11:57:01 CET 2017 on sn-devel-144
2017-01-31 11:57:01 +01:00
Amitay Isaacs
08b4a5f9f1 ctdb-tests: Do not build mutex test if robust mutexes are not supported
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-31 08:08:14 +01:00
Martin Schwenke
296845e5f2 ctdb-docs: Document configuration variable CTDB_NFS_CHECKS_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Jan 20 18:47:04 CET 2017 on sn-devel-144
2017-01-20 18:47:04 +01:00
Martin Schwenke
8eafa2c5df ctdb-scripts: Avoid log noise when NFS checks directory is empty
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-20 15:01:13 +01:00
Amitay Isaacs
e7c2f270b5 ctdb-tests: Drop calls to ctdb_service_managed and ctdb_service_unmanaged
These functions have been removed as part of dropping
CTDB_SERVICE_AUTOSTARTSTOP functionality.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-20 15:01:13 +01:00
Amitay Isaacs
49fb663d6e ctdb-daemon: Remove stale eventd socket
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12513

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Jan 17 15:00:15 CET 2017 on sn-devel-144
2017-01-17 15:00:15 +01:00
Martin Schwenke
eaa508b826 ctdb-tests: Add "13.per_ip_routing shutdown" test
Ensure that it doesn't mangle the rt_tables file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12516

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): Tue Jan 17 06:02:23 CET 2017 on sn-devel-144
2017-01-17 06:02:23 +01:00
Martin Schwenke
f9368f8e12 ctdb-scripts: Fix regression when cleaning up routing table IDs
Commit 0ca00267cd removed explicit
continuations in strings for awk programs.  In one case this causes a
disconnect between condition and action, where an implicit
continuation does not work.  This results in duplicate lines in the
rt_tables file.

Move the opening brace for the action to make the implicit
continuation work as expected.

An alternative would be to revert the removal of the explicit
continuations and add shellcheck tags.  However, that doesn't mean
that an author of future code will necessarily use explicit
continuations, so the same mistake might still be make in the future.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12516

Reported-by: Barry Evans <bevans@pixitmedia.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-17 02:20:16 +01:00
Martin Schwenke
5e00a6b346 ctdb-scripts: Fix remaining uses of "ctdb gratiousarp"
This changed to "ctdb gratarp" some time ago but the scripts were
never updated.

Fix the documentation for the ctdb tool too.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12512

Reported-by: Ralph Böhme <slow@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-17 02:20:16 +01:00
Amitay Isaacs
ed722c3aa9 ctdb-common: Add wait_send/wait_recv to sock_daemon_funcs
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12510

To be able to terminate the daemon from within the implementation,
create a subreq using wait_send() provided by the implementation.
When the subreq is finished, it signals the sock_daemon code to terminate
the daemon.

This avoids the need to keep track of the top level tevent_req causing
layer violation and keeps the code flow straighforward.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Jan 16 21:16:51 CET 2017 on sn-devel-144
2017-01-16 21:16:51 +01:00
Amitay Isaacs
d09469e575 ctdb-common: Avoid any processing after finishing tevent_req
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12510

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-16 17:26:26 +01:00
Amitay Isaacs
d5be557250 ctdb-common: Pass tevent_req to the computation sub-functions
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12510

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-16 17:26:25 +01:00
Amitay Isaacs
31274cf7ae ctdb-common: Use consistent naming for sock_daemon_run computation functions
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12510

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-16 17:26:25 +01:00
Amitay Isaacs
9e09a253b4 ctdb-common: Correct name of sock_daemon_run_send/recv state structure
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12510

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-01-16 17:26:25 +01:00
Amitay Isaacs
ff0d45c403 ctdb-tests: Fix name of the variable representing init script
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Jan 16 15:46:42 CET 2017 on sn-devel-144
2017-01-16 15:46:42 +01:00
Martin Schwenke
ec3415e583 ctdb-scripts: Drop configuration variable CTDB_SCRIPT_DEBUGLEVEL
The debug() function, which is the only user of this variable, is no
longer used.  It is also dropped.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
a9870538c9 ctdb-scripts: Drop function ctdb_check_command()
This is only used in 1 place, so just inline the check.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
c8249dfa0e ctdb-scripts: Inline simple uses of service_start() and service_stop()
This makes the scripts more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
e847ec3ae2 ctdb-scripts: Remove ctdb_service_start() and ctdb_service_stop()
They contain too much unnecessary complexity, some of which was used
to support CTDB_SERVICE_AUTOSTARTSTOP.

Also removed unused functions for service management.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
a9e3b63538 ctdb-scripts: Drop unnecessary function ctdb_check_tcp_init()
The flag this sets is no longer used by ctdb_check_tcp_ports()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
26b7841aa6 ctdb-scripts: Simplify TCP port checking
Commit 86792724a2 added complications on
top of the multiple TCP port checking methods that used to exist.
Life is simpler now and the cause of any failures is obvious.  So just
print a simple message if the port check fails.

Tweak tests to match changes.  Drop one test that becomes a duplicate.

Temporarily tweak ctdb_check_command() so that it passes shellcheck
tests.  It will be removed anyway in a subsequent commit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:08 +01:00
Martin Schwenke
e70e77383c ctdb-scripts: Drop configuration variable CTDB_SERVICE_AUTOSTARTSTOP
This has bit-rotted, at least for NFS.  It can be fixed but it is
better to remove it because it adds a lot of unnecessary complexity.

Variable event_name becomes unused so remove it.  Also remove
associated tests.

To continue to manage/unmanage services while CTDB is running:

* Start service by hand and then flag it as managed

* Mark service as unmanaged and shut it down by hand

In some cases CTDB does something fancy - e.g. start Samba under
"nice", so care is needed.  One technique is to disable the
eventscript, mark as managed, run the startup event by hand and then
re-enable the eventscript.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-16 11:57:07 +01:00
Martin Schwenke
4d8cba6f5d ctdb-tests: Add takeover helper tests with banned/disconnected nodes
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Jan 12 23:11:28 CET 2017 on sn-devel-144
2017-01-12 23:11:28 +01:00
Martin Schwenke
a5b187202f ctdb-takeover: Handle case where there are no RELEASE_IPs to send
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-01-12 19:25:23 +01:00
Amitay Isaacs
b7cfac778e ctdb-takeover: Known and available IP lists should be the same size as nodemap
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12511

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-12 19:25:23 +01:00
Amitay Isaacs
7794497bc9 ctdb-tests: Add robust mutex test
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469

This demonstrates robust mutex bug on linux/glibc system.

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

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Thu Jan 12 07:59:34 CET 2017 on sn-devel-144
2017-01-12 07:59:33 +01:00
Amitay Isaacs
3a56a16b06 ctdb-locking: Explicitly unlock record/db in lock helper
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469

Instead of killing lock helper processes with SIGKILL, send SIGTERM so
lock helper processes can explicitly unlock record/db.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-12 04:12:23 +01:00
Amitay Isaacs
5b1076dc61 ctdb-locking: Remove support for locking multiple databases
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469

The code to lock multiple databases has been dropped from ctdb_lock.c.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-12 04:12:23 +01:00
Amitay Isaacs
4635c22411 ctdb-tests: Do not attempt to unregister the join handler multiple times
MSG_ID_SYNC is broadcast to each node when a MSG_ID_JOIN has been
received from all nodes.  After MSG_ID_SYNC is successfully broadcast,
the join handler is unregistered.  However, if another MSG_ID_JOIN is
received before the join handler is unregistered then MSG_ID_SYNC is
re-broadcast.  This results in multiple attempts to unregister the
join handler.

Once all MSG_ID_JOIN messages are received, unregister the join handler
to ignore any extra MSG_ID_JOIN messages.  Also, make sure that while
join handler is being unregistered, MSG_ID_JOIN messages are ignored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12500

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

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Jan  6 12:27:23 CET 2017 on sn-devel-144
2017-01-06 12:27:23 +01:00
Amitay Isaacs
1dc1689e74 ctdb-tests: Add tests for generic socket I/O
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12500

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-06 08:37:28 +01:00
Amitay Isaacs
e3440d2bbc ctdb-common: Fix a bug in packet reading code for generic socket I/O
queue->offset currently points to the end of available data.  However,
after processing one packet the beginning of the next packet is not
marked explicitly and caused the same packet to be processed again.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12500

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-06 08:37:28 +01:00
Amitay Isaacs
ebc60b2acc ctdb-tests: Add another test for sock_daemon
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12500

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-06 08:37:28 +01:00
Amitay Isaacs
d9370550a7 ctdb-common: Simplify async computation for sock_socket_write_send/recv
This is now just a wrapper around comm_write_send/recv.  This avoids the
extra tevent_req and fixes a bug in the termination of sock_socket_write
computation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12500

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-01-06 08:37:28 +01:00
Martin Schwenke
3660c76dce ctdb-takeover: Clean up when exiting on error
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Dec 28 05:18:08 CET 2016 on sn-devel-144
2016-12-28 05:18:08 +01:00
Martin Schwenke
3b0b29bcb6 ctdb-takeover: Fix CID 1398169 Unchecked return value
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-12-28 01:29:21 +01:00
Volker Lendecke
462e8cea04 ctdb: Fix CID 1398175 Dereference after null check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-12-27 14:21:28 +01:00
Volker Lendecke
96924f7553 ctdb: Fix CID 1398178 Argument cannot be negative
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-12-27 14:21:27 +01:00
Volker Lendecke
93e8876635 ctdb: Fix CID 1398179 Argument cannot be negative
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2016-12-27 14:21:27 +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
641b69da80 ctdb-takeover: Drop unused ctdb_takeover_run() and related code
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
f2485d3ab9 ctdb-recoverd: Integrate takeover helper
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
5b60414265 ctdb-recoverd: Generalise helper state, handler and launching
These can also be used for takeover handler.

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
89b4920539 ctdb-tests: Add tests for takeover helper
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
27cb5d63d5 ctdb-tests: New function unit_test_notrace()
Avoids valgrind and such, so a function can be passed.

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
8d9b41d427 ctdb-takeover: Add takeover helper
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
605347faf6 ctdb-takeover: IPAllocAlgorithm replaces LCP2PublicIPs, DeterministicIPs
Introduce a single new tunable IPAllocAlgorithm to set the IP
allocation algorithm.  This defaults to 2 for LCP2 IP address
allocation.

Tunables LCP2PublicIPs and DeterministicIPs are obsolete.

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
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
c4eab456ab ctdb-docs: Document that tunables should be set the same on 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
3fc38472c6 ctdb-tests: Add faking of control failures/timeouts to fake_ctdbd
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
12de3352d7 ctdb-tests: Add IPREALLOCATED control to fake_ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
421024a270 ctdb-tests: Add TAKEOVER_IP control to fake_ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
fc8ebaddf4 ctdb-tests: Add RELEASE_IP control to fake_ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
32266f09dd ctdb-tests: Add tool tests for "ctdb ip"
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
6f1419f72a ctdb-tests: Implement GET_PUBLIC_IPS control in fake_ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
6d97f39354 ctdb-tests: Add tool tests for "ctdb ipinfo"
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
f3e570952f ctdb-tests: Implement GET_PUBLIC_IP_INFO control in fake_ctdbd
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
d42142246c ctdb-tests: Factor out get_ctdb_iface_list()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
b993771ab0 ctdb-tests: Add public IP state to fake_ctdbd
Read it via a PUBLICIPS section.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
16abc2071b ctdb-tests: Factor out reading of known public IP addresses
One change in behaviour is to actually copy the known IPs per node
instead of just assigning the pointer.  When this is used by
fake_ctdbd the resulting structure will be used to keep state for
individual nodes, so data for nodes needs to be independent.

Also, drop some asserts in the factored code and do (slightly) better
error handling.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
465323d14f ctdb-tests: Allow FAKE_CTDBD_DEBUGLEVEL to be specified
This is useful for debugging when doing developer testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
b03b3f0a3d ctdb-tests: Make fake_ctdbd use logging_init()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
7d1b39cf80 ctdb-client: Add available-only option public IP fetching
Update tool accordingly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Martin Schwenke
44465817dd ctdb-protocol: Move CTDB_PUBLIC_IP_FLAGS_ONLY_AVAILABLE to protocol.h
The protocol code needs it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-19 04:07:07 +01:00
Amitay Isaacs
fc28a74254 ctdb-daemon: Remove ctdb_event_helper
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sun Dec 18 18:10:50 CET 2016 on sn-devel-144
2016-12-18 18:10:50 +01:00
Amitay Isaacs
69b1ae3423 ctdb-daemon: Switch to using event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
bcd7444c57 ctdb-daemon: Add functions to talk to event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
21cac65b67 ctdb-daemon: Refactor check for valid events during recovery
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
c9a0f3015d ctdb-protocol: Deprecate eventscript controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
9272cd42aa ctdb-protocol: Drop marshaling for eventscript controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
3c74c05c75 ctdb-client: Drop client code for eventscript controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
def5f4b1bf ctdb-daemon: Drop implementation of eventscript controls
Following controls are now implemented by event daemon
 - RUN_EVENTSCRIPTS
 - GET_EVENT_SCRIPT_STATUS
 - ENABLE_SCRIPT
 - DISABLE_SCRIPT

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
b2d1cea1f3 ctdb-tool: Drop disablescript, enablescript and eventscript commands
These commands are now replaced with ctdb event ...

ctdb scriptstatus is maintained for backward compatibility.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
a652b5c351 ctdb-tool: Add new command "event" to ctdb tool
This command covers all the commands to event daemon.

  ctdb event run <event>
  ctdb event status [<event>] [lastrun|lastfail|lastpass]
  ctdb event script list
  ctdb event script enable <script>
  ctdb event script disable <script>

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
ca0894e932 ctdb-tests: Add tests for event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
9cbdb40612 ctdb-tool: Add helper for talking to event daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
b678dfb3a4 ctdb-client: Add client api for eventd communication
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:23 +01:00
Amitay Isaacs
950110f3c1 ctdb-eventd: Add event script handling daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
7e8ccef49b ctdb-protocol: Add marshalling for eventd protocol
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
c0c34337d9 ctdb-protocol: Add data types for eventd communication
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
7ae530c2ab ctdb-common: Add sock_daemon abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
75a25d1331 ctdb-common: Add generic socket I/O
This is a generic socket read/write to be used in the ctdb daemon.
It is based on ctdb_io.c and comm.c.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
f0ba41e1c5 ctdb-common: Add run_proc abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
4d3c19d14e ctdb-protocol: Add marshalling for int32_t
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
a6ee085845 ctdb-protocol: Fix marshalling of string with length
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
b2b8f1eaed ctdb-tool: Improve error reporting if helper execution fails
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Amitay Isaacs
590acdc529 ctdb-tool: Allow passing multiple command-line arguments to helper
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-12-18 14:23:22 +01:00
Martin Schwenke
cd20ced3fb ctdb-tools: Don't trust non-hosting nodes in "ctdb ip all"
Redundant RELEASE_IPs gives nodes a preview of where an IP address
will move to.  However, if the associated TAKEOVER_IP fails then the
node will actually be unhosted.

This is similar to commit 77a29b3733.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

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): Fri Dec 16 12:32:02 CET 2016 on sn-devel-144
2016-12-16 12:32:02 +01:00
Martin Schwenke
2514a9cd17 ctdb-tools: Print PNN as int in "ctdb ip -v"
Otherwise it prints 4294967295 for the PNN.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
a6e5b6abe9 ctdb-tools: Skip GET_PUBLIC_IP_INFO for unassigned addresses
The GET_PUBLIC_IP_INFO control fails for unassigned addresses because
PNN is CTDB_UNKNOWN_PNN.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
acaa4407ca ctdb-tools: Fix memory corruption in "ctdb ip -v"
First argument to talloc_asprintf_append() is the string being
appended to, not a talloc context.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
7bcef2f0e2 ctdb-tools: Fix sort order of "ctdb ip" output
The new hash-table-based method of merging the IP information does not
sort, whereas the RB-tree method implicitly sorted.  This probably
only really matters for the "all" case, but sort regardless to ensure
consistent output format.

Sorting has to be done here instead of when printing to ensure
consistency between ip[] and ipinfo[].

No longer reverse the sort order.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
3845ff6349 ctdb-tests: Add unit test for protocol utilities
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00
Martin Schwenke
362f066d61 ctdb-protocol: Add generalised socket address comparison
Add new function ctdb_sock_addr_cmp(), which returns a 3-way result
useful for qsort(3).  Reimplent ctdb_sock_addr_same() using this.

In the process, make arguments const so that ctdb_sock_addr_cmp() can
be used with qsort().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12470

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-12-16 08:42:32 +01:00