ctdb.git
11 years agotests: simple tests against local daemons should check $TEST_LOCAL_DEAMONS
Martin Schwenke [Mon, 2 Jul 2012 04:05:21 +0000 (14:05 +1000)]
tests: simple tests against local daemons should check $TEST_LOCAL_DEAMONS

Note the old $CTDB_TEST_REAL_CLUSTER - it doesn't exist anymore...

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agotests: run_tests should exit with $status with -e option
Martin Schwenke [Wed, 20 Jun 2012 05:57:48 +0000 (15:57 +1000)]
tests: run_tests should exit with $status with -e option

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agotests/simple: ctdb reloadips test should use $test_ip
Martin Schwenke [Thu, 14 Jun 2012 09:37:39 +0000 (19:37 +1000)]
tests/simple: ctdb reloadips test should use $test_ip

There's no point recalculating this value.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agotests: select_test_node_and_ips() should never select non-node -1
Martin Schwenke [Thu, 14 Jun 2012 09:36:04 +0000 (19:36 +1000)]
tests:  select_test_node_and_ips() should never select non-node -1

Instead of selecting the 1st pnn found, select the 1st one that isn't -1.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoutil: Do not lock down memory when running with local daemons
Amitay Isaacs [Thu, 26 Jul 2012 12:01:50 +0000 (22:01 +1000)]
util: Do not lock down memory when running with local daemons

Thanks to Ronnie for highlighting the issue of memory lockdown on AIX.
Fix typo, use getuid and not getpid.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agostatd-callout: Fix a bug in the calculations of $STATE
Martin Schwenke [Thu, 5 Jul 2012 06:27:54 +0000 (16:27 +1000)]
statd-callout: Fix a bug in the calculations of $STATE

It is just meant to be even, so divided *and* multiplied by 2.  Use
$(( )) to make it more readable.

While touching this code, make the related calculation a bit more
readable too.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Default route on NAT gateway should have a metric of 10
Martin Schwenke [Tue, 24 Jul 2012 01:23:09 +0000 (11:23 +1000)]
Eventscripts: Default route on NAT gateway should have a metric of 10

At the moment routes from 11.routing can fail to be added because they
conflict with the default route added by 11.natgw.

NAT gateway is meant to be a last resort, so routes from 11.routing
should override it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Update/remove stale comments in 11.natgw
Martin Schwenke [Tue, 17 Jul 2012 10:10:11 +0000 (20:10 +1000)]
Eventscripts: Update/remove stale comments in 11.natgw

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Retrieve and build NAT gateway details better in 11.natgw
Martin Schwenke [Tue, 17 Jul 2012 05:39:50 +0000 (15:39 +1000)]
Eventscripts: Retrieve and build NAT gateway details better in 11.natgw

* "ctdb natgw" is run twice when it doesn't need to be.

* Tweak the parsing of "ctdb natgw" output so that it is done by the
  shell instead of a bunch of external processes.

* Make default NAT gateway be -1, even on error.  If the process
  failed entirely then it could previously be empty.

* Streamline the error handling using die() for when there is no NAT
  gateway.

* Downcase script-local variable names.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Optimise building the host address in 11.natgw
Martin Schwenke [Tue, 17 Jul 2012 05:37:14 +0000 (15:37 +1000)]
Eventscripts: Optimise building the host address in 11.natgw

It can be build without forking unnecessary processes.

Also downcase variable name because it is local to script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Clean up startup sanity check in 11.natgw
Martin Schwenke [Tue, 17 Jul 2012 05:32:38 +0000 (15:32 +1000)]
Eventscripts: Clean up startup sanity check in 11.natgw

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: remove redundant firewall rules from 11.natgw
Martin Schwenke [Tue, 17 Jul 2012 05:26:16 +0000 (15:26 +1000)]
Eventscripts: remove redundant firewall rules from 11.natgw

aeb70c7e7822854eb87873a5c7783e27e6e72318 said it moved these but it
redundantly duplicated them instead.  That commit also fixed the
problem because it moved the rules after delete_all() not out of the
startup event as claimed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: 11.natgw $CTDB_NATGW_PUBLIC_IP splitting optimisation
Martin Schwenke [Tue, 17 Jul 2012 05:21:10 +0000 (15:21 +1000)]
Eventscripts: 11.natgw $CTDB_NATGW_PUBLIC_IP splitting optimisation

$CTDB_NATGW_PUBLIC_IP can be split into $_ip and $_maskbits without
forking lots of processes.

Also "local" isn't supported by POSIX.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoweb: Add my name to the developer list.
Amitay Isaacs [Tue, 24 Jul 2012 07:27:22 +0000 (17:27 +1000)]
web: Add my name to the developer list.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoRemove tevent_loop_allow_nesting()
Amitay Isaacs [Fri, 15 Jun 2012 01:05:00 +0000 (11:05 +1000)]
Remove tevent_loop_allow_nesting()

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoctdbd: Return explicit boolean values for function returning bool
Amitay Isaacs [Wed, 6 Jun 2012 06:19:10 +0000 (16:19 +1000)]
ctdbd: Return explicit boolean values for function returning bool

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoutil: Do not try to lockdown memory when running in local daemons mode
Amitay Isaacs [Wed, 6 Jun 2012 06:16:15 +0000 (16:16 +1000)]
util: Do not try to lockdown memory when running in local daemons mode

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoFix compiler warnings.
Amitay Isaacs [Fri, 15 Jun 2012 05:07:04 +0000 (15:07 +1000)]
Fix compiler warnings.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agorun_tests: improve spacing
Michael Adam [Tue, 3 Jul 2012 09:50:05 +0000 (11:50 +0200)]
run_tests: improve spacing

11 years agorun_tests.sh: fix a comment
Michael Adam [Tue, 3 Jul 2012 09:46:26 +0000 (11:46 +0200)]
run_tests.sh: fix a comment

11 years agoctdb: use correct "persistent" state for ctdb_attach in "ctdb cattdb"
Michael Adam [Tue, 3 Jul 2012 12:28:36 +0000 (14:28 +0200)]
ctdb: use correct "persistent" state for ctdb_attach in "ctdb cattdb"

Originally, "ctdb cattdb" attached explicitly as non-persistent, which
is now forbidden for persistent databases by the server.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

11 years agoctdbd: refuse attaching with "persistent" to a non-persistent db and v.v.
Gregor Beck [Thu, 21 Jun 2012 08:26:03 +0000 (10:26 +0200)]
ctdbd: refuse attaching with "persistent" to a non-persistent db and v.v.

Signed-off-by: Michael Adam <obnox@samba.org>
11 years agoWhen we find an ip we shouldnt host, just release it
Ronnie Sahlberg [Wed, 20 Jun 2012 05:10:05 +0000 (15:10 +1000)]
When we find an ip we shouldnt host, just release it

Dont call a full blown clusterwide ipreallocation,  just release it locally

11 years agoWhen we release an ip, get the interface name from the kernel
Ronnie Sahlberg [Wed, 20 Jun 2012 00:08:11 +0000 (10:08 +1000)]
When we release an ip, get the interface name from the kernel

instead of using the interface where ctdb thinks the ip is hosted at.
The difference is that this now allows us to handle cases where we want to release an ip   but ctdbd does not know which interface the ip is assigned on.
(user has used 'ip addr add...'  and manually assigned an ip to the wrong interface)

11 years agoAdd new command to find which interface is located on
Ronnie Sahlberg [Wed, 20 Jun 2012 03:32:02 +0000 (13:32 +1000)]
Add new command to find which interface is located on

12 years agoSTATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount
Ronnie Sahlberg [Wed, 13 Jun 2012 06:17:18 +0000 (16:17 +1000)]
STATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount

and add mechanisms to dump it using the ctdb dbstatistics command

12 years agoReimplement logging of long running events
Martin Schwenke [Thu, 7 Jun 2012 05:08:15 +0000 (15:08 +1000)]
Reimplement logging of long running events

Reimplement 5aba53e6adcfcd7edbdac9e30aa5fcba176aca00 using tevent
trace points.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotevent: change version to 0.9.16
Stefan Metzmacher [Fri, 8 Jun 2012 10:50:21 +0000 (12:50 +0200)]
tevent: change version to 0.9.16

This adds tevent_*_trace_*() and tevent_context_init_ops()

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun  8 20:47:41 CEST 2012 on sn-devel-104

12 years agotevent: expose tevent_context_init_ops
Stefan Metzmacher [Fri, 11 May 2012 13:19:55 +0000 (15:19 +0200)]
tevent: expose tevent_context_init_ops

This can be used to implement wrapper backends,
while passing a private pointer to the backens init function
via ev->additional_data.

metze

12 years agolib/tevent: Add trace point callback
Martin Schwenke [Tue, 5 Jun 2012 06:00:07 +0000 (16:00 +1000)]
lib/tevent: Add trace point callback

Set/get a single callback function to be invoked at various trace
points.  Define "before wait" and "after wait" trace points - more
trace points can be added later if required.

CTDB wants this to log long waits and events.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 years agoRevert "TEVENT: Add back tracking of long runnig events to the local copy of tevent...
Martin Schwenke [Thu, 7 Jun 2012 04:20:13 +0000 (14:20 +1000)]
Revert "TEVENT: Add back tracking of long runnig  events to the local copy of tevent library"

This reverts commit 5aba53e6adcfcd7edbdac9e30aa5fcba176aca00.

Do this using new tevent trace point callback.

12 years agolib/tevent: In poll_event_context, add a pointer back to the tevent_context
Martin Schwenke [Thu, 7 Jun 2012 02:26:02 +0000 (12:26 +1000)]
lib/tevent: In poll_event_context, add a pointer back to the tevent_context

This makes it consistent with the other backends.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
12 years agolib/tevent/testsuite: no longer use 'compat' symbols
Stefan Metzmacher [Mon, 14 May 2012 09:48:00 +0000 (11:48 +0200)]
lib/tevent/testsuite: no longer use 'compat' symbols

metze

12 years agoRun the shutdown eventscript before we tear down the transport
Ronnie Sahlberg [Wed, 30 May 2012 01:50:13 +0000 (11:50 +1000)]
Run the shutdown eventscript before we tear down the transport

This allows eventscripts to still be able to call and use ctdb during the shutdown phase.

12 years agotests: Increment RSN always in ctdb_update_record_persistent test
Amitay Isaacs [Fri, 25 May 2012 05:57:14 +0000 (15:57 +1000)]
tests: Increment RSN always in ctdb_update_record_persistent test

If the record does not exist in persistent DB, RSN for that record is
considered 0. To write a record, RSN for that record should be set to 1,
otherwise the RSN check would fail.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agotests: Fix ctdb_fetch test (parse extra lines of output)
Amitay Isaacs [Fri, 25 May 2012 01:40:38 +0000 (11:40 +1000)]
tests: Fix ctdb_fetch test (parse extra lines of output)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agotests: Fix flakey behavior of ctdb_fetch test
Amitay Isaacs [Thu, 24 May 2012 06:46:07 +0000 (16:46 +1000)]
tests: Fix flakey behavior of ctdb_fetch test

There were two issues with this test:

1. Since the messages are sent from one node to the next, if a node
   does not register for messages before CTDB on that nodes receives
   the message, it will never be seen by ctdb_fetch and it would
   block on receive and would not send any messages to next node.
   The crude solution is to sleep just before the messages are sent,
   so that ctdb_fetch on all nodes have registered for the messages.

2. If ctdb_fetch stops sending messages after timelimit expiry, the
   next node will keep waiting to receive messages in event_loop_once().
   The default timeout is 30 seconds for event_loop_once(). Adding a
   timed event will always set the timeout value to the time remaining
   for the timed event to expire.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agoserver: Replace BOOL datatype with bool, True/False with true/false
Amitay Isaacs [Thu, 17 May 2012 06:08:37 +0000 (16:08 +1000)]
server: Replace BOOL datatype with bool, True/False with true/false

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agotests/eventscripts: Tweak expected output for lockd:b restart
Martin Schwenke [Fri, 25 May 2012 01:44:56 +0000 (11:44 +1000)]
tests/eventscripts: Tweak expected output for lockd:b restart

Commit 13acd58c41fba1a33894fbd654fed69ea0eac322 mades this test fail,
since lockd:b and lockd:bs were incorrectly producing the same output.

12 years agotests: Complex tests must not be run from a cluster node
Martin Schwenke [Wed, 23 May 2012 05:36:01 +0000 (15:36 +1000)]
tests: Complex tests must not be run from a cluster node

Tickle tests fail if run from a node involved in the test.

The condition is actually weaker than this: the test can't be run from
a CTDB node that is hosting public addresses that may be used by the
test.

Rework ctdb_test_check_real_cluster() to support checking this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: Fix deprecated iptables ! usage
Martin Schwenke [Wed, 23 May 2012 04:24:40 +0000 (14:24 +1000)]
Eventscripts: Fix deprecated iptables ! usage

This currently causes warning in the logs.

This change is not SLES10-compatible but we already have some other
non-SLES10-compatible changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: test_wrap needs to set TEST_BIN_DIR when installed
Martin Schwenke [Tue, 22 May 2012 01:24:05 +0000 (11:24 +1000)]
tests: test_wrap needs to set TEST_BIN_DIR when installed

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agopackaging: make ctdb-tests package depend on nc
Amitay Isaacs [Fri, 18 May 2012 02:59:41 +0000 (12:59 +1000)]
packaging: make ctdb-tests package depend on nc

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agotests: Use per node log files when running tests with local daemons
Amitay Isaacs [Thu, 10 May 2012 06:59:39 +0000 (16:59 +1000)]
tests: Use per node log files when running tests with local daemons

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agoRECOVERY: Increase the time we allow before timing out recovery related tasks.
Ronnie Sahlberg [Fri, 25 May 2012 02:31:11 +0000 (12:31 +1000)]
RECOVERY: Increase the time we allow before timing out recovery related tasks.

If the system is temporarily taking unusually long to perform these tasks it is better to wait a lot longer and allow the tasks to complete than timing out repeatedly and then becomming banned.

12 years agoRECOVER: When we pull databases during recovery, we used to reallocate the databuffer...
Ronnie Sahlberg [Fri, 25 May 2012 02:27:59 +0000 (12:27 +1000)]
RECOVER: When we pull databases during recovery, we used to reallocate the databuffer for each entry added. This would normally not be an issue, but for cases where memory is fragmented, this could start to cost significant cpu if we need to reallocate and move to a different region.

Change this to instead preallocate , by default, 10MByte chunks to the data buffer.
This significantly reduces the number of potential reallocate and move  operations that may be required.

Create a tunable to override/change how much preallocation should be used.

12 years agoDOCS: Document the new tunables to produce warnings if databases grow unexpectedly...
Ronnie Sahlberg [Mon, 21 May 2012 04:01:04 +0000 (14:01 +1000)]
DOCS: Document the new tunables to produce warnings if databases grow unexpectedly big.

12 years agoDEBUG: Add checks for and print debug messages when 1) a database contains very many...
Ronnie Sahlberg [Mon, 21 May 2012 03:11:38 +0000 (13:11 +1000)]
DEBUG: Add checks for and print debug messages when 1) a database contains very many records, 2) when a database is very big, 3) when a single record is very big.

Add tunables to control when to log these instances and allow it to be completely turned off by setting the threshold to 0

12 years agoTEVENT: Add back tracking of long runnig events to the local copy of tevent library
Ronnie Sahlberg [Sun, 20 May 2012 23:17:05 +0000 (09:17 +1000)]
TEVENT: Add back tracking of long runnig  events to the local copy of tevent library

12 years agoGANESHA: make the ganesha script executable by default
Ronnie Sahlberg [Thu, 17 May 2012 01:16:57 +0000 (11:16 +1000)]
GANESHA: make the ganesha script executable by default

12 years agoMerge remote branch 'martins/ganesha'
Ronnie Sahlberg [Thu, 17 May 2012 01:48:07 +0000 (11:48 +1000)]
Merge remote branch 'martins/ganesha'

12 years agoDebug: When scripts hang, we may need to collect additional data in order to debug...
Ronnie Sahlberg [Thu, 17 May 2012 00:17:51 +0000 (10:17 +1000)]
Debug: When scripts hang, we may need to collect additional data in order to debug why the script hung.

Break this debug and datacollection out into an external script to make it easier to modify what data we need to collect.
For now we only collect a pstree so we can see what part of the script we hung in.

S1037271

12 years agoEventscripts: Modernise 60.ganesha to match 60.nfs
Martin Schwenke [Wed, 16 May 2012 07:24:21 +0000 (17:24 +1000)]
Eventscripts: Modernise 60.ganesha to match 60.nfs

Originally from Srikrishan Malik <srikrishan.malik@in.ibm.com> with
some style changes by me.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: restart lockd in the background when going unhealthy
Martin Schwenke [Wed, 16 May 2012 03:29:58 +0000 (13:29 +1000)]
Eventscripts: restart lockd in the background when going unhealthy

Sometimes the restart can hang when there are I/O problems.  Then the
eventscript times out and gets killed so the node never marked as
unhealthy.

Restarting in the background avoids this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: add optional version to nfs_check_rpc_service()
Martin Schwenke [Tue, 8 May 2012 04:53:58 +0000 (14:53 +1000)]
Eventscript functions: add optional version to nfs_check_rpc_service()

This can be optional because the 1st item of each action-triple is a
test comparison that starts with '-'.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Move the "ctdb reloadips" test from complex/ to simple/
Martin Schwenke [Mon, 14 May 2012 05:11:14 +0000 (15:11 +1000)]
tests: Move the "ctdb reloadips" test from complex/ to simple/

This is made possible by separation of public addresses files for
local daemons and the addition of get_ctdbd_command_line_option().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Fix a typo in daemons_setup()
Martin Schwenke [Mon, 14 May 2012 05:01:44 +0000 (15:01 +1000)]
tests: Fix a typo in daemons_setup()

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: New function get_ctdbd_command_line_option() for integration testing
Martin Schwenke [Mon, 14 May 2012 05:00:32 +0000 (15:00 +1000)]
tests: New function get_ctdbd_command_line_option() for integration testing

This allows, for example, the public addresses file used by a
particular daemon to be known.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Use per-daemon public_addresses file for local daemons
Martin Schwenke [Mon, 14 May 2012 04:59:22 +0000 (14:59 +1000)]
tests: Use per-daemon public_addresses file for local daemons

This allows a node's public addresses file to be hacked for testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Restore the old behaviour of "make test" so it uses tests/var
Martin Schwenke [Mon, 14 May 2012 02:47:02 +0000 (12:47 +1000)]
tests: Restore the old behaviour of "make test" so it uses tests/var

This is finally possible, given all the other changes...  :-)

This is a good default because daemons will be left running, test/var
will still exist and test failures can be investigated.

To "automatically" clean up, do:

  ./tests/run_tests.sh -C -V tests/var -- tests/simple/99_daemons_shutdown.sh

... although "killall ctdbd ; rm -rf tests/var" is less keystrokes.  ;-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Fix wrapper scripts to handle options and tests without breakage
Martin Schwenke [Mon, 14 May 2012 01:57:20 +0000 (11:57 +1000)]
tests: Fix wrapper scripts to handle options and tests without breakage

If the -V option is given and no tests are supplied, the "cd" command
in run_tests.sh cause scripts/run_tests to interpret the argument to
-V incorrectly.  Therefore, the wrapper scripts can't use "cd" because
they don't know what the options are doing!

Instead scripts/run_tests searches for each test relative to the
current directory and, if not previously found, then searches relative
to the top-level tests directory.  This is a much better way of doing
things.

Given that run_tests.sh and run_cluster_tests.sh were starting to
contain duplicate complex logic, remove run_cluster_tests.sh and
replace it with a symlink to run_tests.sh.  Run_tests.sh checks $0 to
see what options/defaults to use.  Update INSTALL to deal with this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Add a test for "ctdb reloadips"
Martin Schwenke [Fri, 11 May 2012 02:13:24 +0000 (12:13 +1000)]
tests: Add a test for "ctdb reloadips"

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: In integration tests, use --node-ip to avoid locking weirdness
Martin Schwenke [Thu, 10 May 2012 06:58:16 +0000 (16:58 +1000)]
tests: In integration tests, use --node-ip to avoid locking weirdness

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Allow run_cluster_tests.sh to take options
Martin Schwenke [Thu, 10 May 2012 06:17:44 +0000 (16:17 +1000)]
tests: Allow run_cluster_tests.sh to take options

However, options must be followed by "--".

This also fixes:

* a bug where specifying tests caused local daemons to be used; and
* an incorrect comment.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Allow run_tests.sh to take options
Martin Schwenke [Thu, 10 May 2012 04:55:19 +0000 (14:55 +1000)]
tests: Allow run_tests.sh to take options

However, options must be followed by "--".

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: Fix a policy routing test
Martin Schwenke [Thu, 10 May 2012 04:32:06 +0000 (14:32 +1000)]
tests/eventscripts: Fix a policy routing test

The previous commit 55006ea8999ab3721fcde81b92692661065f0688
highlighted an error in this test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: $CTDB_BASE needs to be in $TEST_VAR_DIR
Martin Schwenke [Thu, 10 May 2012 04:16:45 +0000 (14:16 +1000)]
tests/eventscripts: $CTDB_BASE needs to be in $TEST_VAR_DIR

The policy routing tests write the configuration file into $CTDB_BASE,
as per rcommended practice.  Unless this is in $TEST_VAR_DIR this
won't work sensible when the tests are installed.

Things are done slightly different than for /etc.  Here we use
symlinks and we want them to be dereferenced.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoPackaging: Improve dependencies
Martin Schwenke [Wed, 9 May 2012 07:20:27 +0000 (17:20 +1000)]
Packaging: Improve dependencies

We don't strictly need gawk (i.e. could probably use nawk), but that
seems to provide /bin/awk on RHEL.

PreReq seems old-school.  We don't have an scriptlets, so nothing
needs to be installed before CTDB.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoPackaging: add options to ctdb.spec.in to force use of bundled libraries
Martin Schwenke [Wed, 9 May 2012 06:03:00 +0000 (16:03 +1000)]
Packaging: add options to ctdb.spec.in to force use of bundled libraries

Ideas borrowed from the Fedora samba4 spec file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: add optional version to nfs_check_rpc_service()
Martin Schwenke [Tue, 8 May 2012 04:53:58 +0000 (14:53 +1000)]
Eventscript functions: add optional version to nfs_check_rpc_service()

This can be optional because the 1st item of each action-triple is a
test comparison that starts with '-'.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoPackaging: devel package fixes
Martin Schwenke [Fri, 11 May 2012 00:32:26 +0000 (10:32 +1000)]
Packaging: devel package fixes

Group was non-existent, typo in summary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoPackaging: generate a ctdb-tests package
Martin Schwenke [Thu, 3 May 2012 02:12:53 +0000 (12:12 +1000)]
Packaging: generate a ctdb-tests package

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoWe dont need to serialize the "probe which address this node is" if we have given...
Ronnie Sahlberg [Thu, 10 May 2012 07:40:22 +0000 (17:40 +1000)]
We dont need to serialize the "probe which address this node is" if we have given an explicit --node-ip on the commandline

12 years agoTrack all child process so we never send a signal to an unrelated process (our child...
Ronnie Sahlberg [Thu, 3 May 2012 01:42:41 +0000 (11:42 +1000)]
Track all child process so we never send a signal to an unrelated process (our child died  and kernel wrapped the pid-space and reused the pid for a different process

Wrap all creation of child processes inside ctdb_fork() which is used to track all processes we have spawned.
Capture SIGCHLD to track also which child processes have terminated.

Wrap kill() inside ctdb_kill() and make sure that we never send a !0 signal to a child process pid that has already terminated (and might have been replaced with a

12 years agoDOC: document the reloadips command
Ronnie Sahlberg [Thu, 3 May 2012 01:06:55 +0000 (11:06 +1000)]
DOC: document the reloadips command

12 years agoRELOADIPS: simplify the reloadips code a bit
Ronnie Sahlberg [Tue, 1 May 2012 05:27:12 +0000 (15:27 +1000)]
RELOADIPS: simplify the reloadips code a bit
and also update the "read public address file" to not check if the address exists already locally when we read if from the child process, to stop it
from spamming the logs with "We already host ..."
messages

12 years agoRevert "server: locking: Provide a common API for non-blocking locking of TDBs"
Amitay Isaacs [Tue, 1 May 2012 02:09:48 +0000 (12:09 +1000)]
Revert "server: locking: Provide a common API for non-blocking locking of TDBs"

This reverts commit 6a92fc2b8da2bba98dca29b781ab459ba4e879a5.

Reverting incomplete changes to ctdb_lock.c

12 years agoserver: locking: Provide a common API for non-blocking locking of TDBs
Amitay Isaacs [Thu, 26 Apr 2012 05:48:12 +0000 (15:48 +1000)]
server: locking: Provide a common API for non-blocking locking of TDBs

12 years agotests/simple: Fix typo in the test message
Amitay Isaacs [Mon, 23 Apr 2012 05:53:29 +0000 (15:53 +1000)]
tests/simple: Fix typo in the test message

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
12 years agoAdd new control to reload the public ip address file on a node
Ronnie Sahlberg [Mon, 30 Apr 2012 05:50:44 +0000 (15:50 +1000)]
Add new control to reload the public ip address file on a node

Also add a method to use the recovery master/daemon to reload the public ips on all nodes in the cluster.
Reloading the public ips on all node sin the cluster is only suported if all nodes in the cluster are available and healthy.

12 years agotests: Update README
Martin Schwenke [Fri, 27 Apr 2012 07:19:45 +0000 (17:19 +1000)]
tests: Update README

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: $CTDB_ETCDIR should be in $TEST_VAR_DIR
Martin Schwenke [Fri, 27 Apr 2012 04:17:52 +0000 (14:17 +1000)]
tests/eventscripts: $CTDB_ETCDIR should be in $TEST_VAR_DIR

The policy routing tests modify /etc/iproute2/rt_tables, so this
directory should not be in the installation area.

Instead the contents of tests/eventscripts/etc are copied into a place
under $TEST_VAR_DIR where the directory can be modified with gay
abandon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: Use a canned ctdb.sysconfig rather than a link
Martin Schwenke [Fri, 27 Apr 2012 04:16:16 +0000 (14:16 +1000)]
tests/eventscripts: Use a canned ctdb.sysconfig rather than a link

The link is hard to manage and has no real advantage.

The canned config is 2 of the 3 currently non-comment/whitespace lines
in config/ctdb.sysconfig.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: Explicitly set CTDB_SERVICE_AUTOSTARTSTOP="yes"
Martin Schwenke [Fri, 27 Apr 2012 04:15:06 +0000 (14:15 +1000)]
tests/eventscripts: Explicitly set CTDB_SERVICE_AUTOSTARTSTOP="yes"

No use depending on defaults in the initscript - the tests should
control what is tested.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: Be more defensive about removing the var directory
Martin Schwenke [Tue, 24 Apr 2012 07:17:59 +0000 (17:17 +1000)]
tests/eventscripts: Be more defensive about removing the var directory

Could add -r but that might avoid error.  The only time it doesn't
exist is the 1st time a top-level var directory is used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: fix basename -> dirname typo
Martin Schwenke [Tue, 24 Apr 2012 07:17:07 +0000 (17:17 +1000)]
Eventscripts: fix basename -> dirname typo

I fixed one of these previously but didn't notice this one...  :-(

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: Add sanity check to esnure events.d/ can be found
Martin Schwenke [Tue, 24 Apr 2012 06:59:38 +0000 (16:59 +1000)]
tests/eventscripts: Add sanity check to esnure events.d/ can be found

If it can't, the installation is probably inconsistent, so a
(hopefully) helpful message is printed.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Add installation script for tests
Martin Schwenke [Tue, 24 Apr 2012 06:28:15 +0000 (16:28 +1000)]
tests: Add installation script for tests

This could all be done in Makefile.in, but that would be very complex.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/simple: Add new pseudo testcase to potentially shutdown local daemons
Martin Schwenke [Tue, 24 Apr 2012 04:40:52 +0000 (14:40 +1000)]
tests/simple: Add new pseudo testcase to potentially shutdown local daemons

Only shuts them down if $TEST_CLEANUP is true.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: New run_tests -C (cleanup) option
Martin Schwenke [Tue, 24 Apr 2012 04:39:24 +0000 (14:39 +1000)]
tests: New run_tests -C (cleanup) option

Sets TEST_CLEANUP=true and causes $TEST_VAR_DIR to be removed... and
potentially other cleanup actions in testcases.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/eventscripts: $FAKE_IP_STATE is always set in ip command stub
Martin Schwenke [Tue, 24 Apr 2012 04:04:36 +0000 (14:04 +1000)]
tests/eventscripts: $FAKE_IP_STATE is always set in ip command stub

No need for a default, especially since there is no sane default!

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Time logging in integration tests should use TEST_VAR_DIR
Martin Schwenke [Tue, 24 Apr 2012 04:03:41 +0000 (14:03 +1000)]
tests: Time logging in integration tests should use TEST_VAR_DIR

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Unit tests should use $TEST_VAR_DIR
Martin Schwenke [Tue, 24 Apr 2012 04:02:28 +0000 (14:02 +1000)]
tests: Unit tests should use $TEST_VAR_DIR

This directory is already guaranteed to be absolute, so no check is
needed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Improve the logic for adding directories to $PATH
Martin Schwenke [Tue, 24 Apr 2012 01:50:36 +0000 (11:50 +1000)]
tests: Improve the logic for adding directories to $PATH

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Update integration.sh to use TEST_VAR_DIR
Martin Schwenke [Tue, 24 Apr 2012 01:39:07 +0000 (11:39 +1000)]
tests: Update integration.sh to use TEST_VAR_DIR

There are 2 subtleties:

* Local daemons currently use the in-tree tests/events.d/ subdirectory
  for their eventscripts.  However, some tests install/remove test-specific
  eventscripts so now $TEST_VAR_DIR/events.d/ is used and the standard
  eventscripts are copied there at setup time.

* The pgrep/pkill logic for killing local daemons currently relies on
  ctdbd being run with a full path to tests/bin/ctdbd.  If the tests
  are installed and run against an installed daemon then this won't
  work.  Therefore, ctdbd is now expected to be in $PATH and is
  found/killed by matching:

    ctdbd --socket=.* --nlist .* --nopublicipcheck

  This is complex but should avoid killing a real ctdbd running on a
  node.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Add a -V option to set new variable TEST_VAR_DIR
Martin Schwenke [Tue, 24 Apr 2012 00:25:50 +0000 (10:25 +1000)]
tests: Add a -V option to set new variable TEST_VAR_DIR

Part of preparation to be able to install the tests.  The current var/
subdirectories will end up somewhere in /usr/local/ or /usr/ and we
don't want to put temporary files there.

This creates a temporary TEST_VAR_DIR by default.

If -V is specified then the given directory will be used as
TEST_VAR_DIR.  This allows the current behaviour where individual
integration tests can be run against already-running daemons 9with
sockets and other stuff already created) to save time and trouble.

Yes, there are plans for a clean-up option...  ;-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/integration: Remove cabability for testcase option
Martin Schwenke [Tue, 24 Apr 2012 00:23:17 +0000 (10:23 +1000)]
tests/integration: Remove cabability for testcase option

This is unused and can't be used with the current test infrastructure.
It may have been useful with ctdb_test_env but I don't think it was
ever used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/integration: Use absolute path for socket symlink
Martin Schwenke [Mon, 23 Apr 2012 04:45:04 +0000 (14:45 +1000)]
tests/integration: Use absolute path for socket symlink

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests/simple: Replace "tdbdump" with "ctdb cattdb"
Martin Schwenke [Mon, 23 Apr 2012 04:40:28 +0000 (14:40 +1000)]
tests/simple: Replace "tdbdump" with "ctdb cattdb"

tdbdump may not be installed and would be an unnecessary dependency.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agotests: Make run_tests -X more flexible - it now works with onnode
Martin Schwenke [Fri, 20 Apr 2012 06:43:17 +0000 (16:43 +1000)]
tests: Make run_tests -X more flexible - it now works with onnode

Hardcoding "sh -x" is suboptimal because some scripts, like onnode,
require bash.

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