ctdb.git
12 years agoEventscript functions: fix counter regression.
Martin Schwenke [Wed, 15 Dec 2010 23:11:33 +0000 (10:11 +1100)]
Eventscript functions: fix counter regression.

d362be7d32079ac1390d67056ce107bfbca2c937 wasn't well thought out.
Subsequent commits depend on ctdb_counter_init() taking an argument,
so this makes those cases work.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: ctdb_service_check-reconfigure() acts only on monitor.
Martin Schwenke [Wed, 15 Dec 2010 22:50:44 +0000 (09:50 +1100)]
Eventscript functions: ctdb_service_check-reconfigure() acts only on monitor.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: make 50.samba use $service_state_dir.
Martin Schwenke [Fri, 17 Dec 2010 05:29:21 +0000 (16:29 +1100)]
Eventscripts: make 50.samba use $service_state_dir.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 60.nfs to use ctdb_service_check_reconfigure.
Martin Schwenke [Wed, 15 Dec 2010 22:45:28 +0000 (09:45 +1100)]
Evenscripts: update 60.nfs to use ctdb_service_check_reconfigure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 60.nfs to use ctdb_setup_service_state_dir.
Martin Schwenke [Wed, 15 Dec 2010 21:57:46 +0000 (08:57 +1100)]
Evenscripts: update 60.nfs to use ctdb_setup_service_state_dir.

The state directory basename becomes "nfs" rather than "statd".  One
line of code i moved from the "startup" event to service_start().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 40.vsftpd to use ctdb_service_check_reconfigure.
Martin Schwenke [Wed, 15 Dec 2010 22:48:25 +0000 (09:48 +1100)]
Evenscripts: update 40.vsftpd to use ctdb_service_check_reconfigure.

To simplify we also remove the reconfigure from the recovered event
because the monitor event will handle this very quickly anyway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 41.httpd to use ctdb_service_check_reconfigure.
Martin Schwenke [Wed, 15 Dec 2010 22:47:10 +0000 (09:47 +1100)]
Evenscripts: update 41.httpd to use ctdb_service_check_reconfigure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: rejig the reconfigure infrastructure.
Martin Schwenke [Wed, 15 Dec 2010 08:19:21 +0000 (19:19 +1100)]
Eventscripts: rejig the reconfigure infrastructure.

* Add an optional service name argument to existing reconfigure
  functions.

* User function service_reconfigure() instead of variable
  $service_reconfigure to specify how a service is reconfigured.

* New function ctdb_service_check_reconfigure() reconfigures a service
  if it is flagged for reconfigure.

* Remove $service_reconfigure settings from 40.vsftpd and 41.httpd -
  they're the defaults.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: move flagging of managed services.
Martin Schwenke [Wed, 15 Dec 2010 05:34:00 +0000 (16:34 +1100)]
Eventscript functions: move flagging of managed services.

Move flagging of managed or unmanaged services into
ctdb_service_start() and ctdb_service_stop().  That way services will
be correctly flagged if they are started from the startup and shutdown
events.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript function: change service_start into a function.
Martin Schwenke [Wed, 10 Aug 2011 23:39:25 +0000 (09:39 +1000)]
Eventscript function: change service_start into a function.

service_start is currently a variable.  This makes passing arguments
hard.  We change it to be a function and put default definitions into
the functions file.

We use a convention that if a service name argument is passed to a
redefined version of service_start() or service_stop() then it will
act unconditionally.  If no argument is passed then it can use
internal logic to decide if services should really be started.  This
is useful when a single eventscript handles multiple services.

This is a cherry-pick of ae38895 that needed to be reset mid-stream.
There is still some breakage following this commit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: add optional event name argument to fail count functions.
Martin Schwenke [Tue, 14 Dec 2010 23:48:00 +0000 (10:48 +1100)]
Eventscript functions: add optional event name argument to fail count functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions - optimise is_ctdb_managed_service().
Martin Schwenke [Thu, 18 Nov 2010 05:19:45 +0000 (16:19 +1100)]
Eventscript functions - optimise is_ctdb_managed_service().

This function generates a lot of trace when running under "set -x".
This is due to the backward compatibility code.

This adds 3 optimisations:

1. Before invoking the backward compatiblity code,
   is_ctdb_managed_service() returns early if the service is listed in
   $CTDB_MANAGED_SERVICES.

2. ctdb_compat_managed_service() actually now updates
   $CTDB_MANAGED_SERVICES instead of temporary variable $t.

   This means that a subsequent call to is_ctdb_managed_service() will
   short circuit due to optimisation (1).

3. ctdb_compat_managed_service() only adds a service to
   $CTDB_MANAGED_SERVICES if it is the service being checked by
   is_ctdb_managed_service().

   This stops irrelevant services being added to
   $CTDB_MANAGED_SERVICES multiple times by multiple calls to
   is_ctdb_managed_service().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years ago50.samba eventscript should use is_ctdb_managed_service "winbind".
Martin Schwenke [Thu, 18 Nov 2010 05:03:47 +0000 (16:03 +1100)]
50.samba eventscript should use is_ctdb_managed_service "winbind".

Currently it checks $CTDB_MANAGES_WINBIND directly in several places.
This doesn't work when someone sets $CTDB_MANAGED_SERVICES directly.

This modifies check_ctdb_manages_winbind() so that it return a
condition rather than modifying $CTDB_MANAGES_WINBIND.  This makes
some code more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years ago50.samba eventscript should use is_ctdb_managed_service "samba".
Martin Schwenke [Thu, 18 Nov 2010 03:34:48 +0000 (14:34 +1100)]
50.samba eventscript should use is_ctdb_managed_service "samba".

Currently it checks $CTDB_MANAGES_SAMBA directly.  This doesn't work
when someone sets $CTDB_MANAGED_SERVICES directly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years ago50.samba eventscript should stop/start services when they become (un)managed.
Martin Schwenke [Thu, 18 Nov 2010 00:04:52 +0000 (11:04 +1100)]
50.samba eventscript should stop/start services when they become (un)managed.

When the value of $CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND (or
corresponding changes are made to $CTDB_MANAGED_VERSIONS), the
associated service should be started or stopped as necessary.

This add calls to ctdb_start_stop_service() to manage
starting/stopping samba and winbind.

An associated cleanup is made to the initial checks that one of
$CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND is set, replacing them
with calls to is_ctdb_managed_service().

To handle the winbind cases ctdb_start_stop_service() and
is_ctdb_managed_service() are updated to take an optional service name
parameter.

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

config/events.d/50.samba

Most of this merged elsewhere.  This just removes a check that
this is the monitor event.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoAdd documentation for the new filesystem use monitoring
Ronnie Sahlberg [Thu, 11 Aug 2011 00:07:50 +0000 (10:07 +1000)]
Add documentation for the new filesystem use monitoring

12 years agoAdd new eventscript 40.fs_use that can be used to monitor file system use and flag...
Ronnie Sahlberg [Thu, 11 Aug 2011 00:00:53 +0000 (10:00 +1000)]
Add new eventscript 40.fs_use that can be used to monitor file system use and flag a node unhealthy when they become full

12 years agomake the persistent even longer for lvs to make people even happier
Ronnie Sahlberg [Wed, 10 Aug 2011 23:11:38 +0000 (09:11 +1000)]
make the persistent even longer for lvs to make people even happier

12 years agoincrease the persistent timeout to make people happier
Ronnie Sahlberg [Wed, 10 Aug 2011 21:14:57 +0000 (07:14 +1000)]
increase the persistent timeout to make people happier

12 years agocheck the shares if they are available before we decide to try to restart nfs
Ronnie Sahlberg [Wed, 10 Aug 2011 21:13:28 +0000 (07:13 +1000)]
check the shares if they are available before we decide to try to restart nfs

CQ S1027529

12 years agoMerge remote branch 'martins/eventscript.00.ctdb'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:36:20 +0000 (15:36 +1000)]
Merge remote branch 'martins/eventscript.00.ctdb'

12 years agoMerge branch 'eventscript.20.multipathd' into eventscript.00.ctdb
Martin Schwenke [Wed, 10 Aug 2011 05:32:58 +0000 (15:32 +1000)]
Merge branch 'eventscript.20.multipathd' into eventscript.00.ctdb

12 years agoMerge remote branch 'martins/eventscript.20.multipathd'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:32:24 +0000 (15:32 +1000)]
Merge remote branch 'martins/eventscript.20.multipathd'

12 years agoMerge branch 'eventscript.62.cnfs' into eventscript.20.multipathd
Martin Schwenke [Wed, 10 Aug 2011 05:32:11 +0000 (15:32 +1000)]
Merge branch 'eventscript.62.cnfs' into eventscript.20.multipathd

12 years agoMerge remote branch 'martins/eventscript.62.cnfs'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:31:56 +0000 (15:31 +1000)]
Merge remote branch 'martins/eventscript.62.cnfs'

12 years agoMerge branch 'eventscript.13.per_ip_routing' into eventscript.62.cnfs
Martin Schwenke [Wed, 10 Aug 2011 05:31:13 +0000 (15:31 +1000)]
Merge branch 'eventscript.13.per_ip_routing' into eventscript.62.cnfs

12 years agoMerge remote branch 'martins/eventscript.13.per_ip_routing'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:22:46 +0000 (15:22 +1000)]
Merge remote branch 'martins/eventscript.13.per_ip_routing'

12 years agoMerge remote branch 'martins/eventscript_tests'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:18:16 +0000 (15:18 +1000)]
Merge remote branch 'martins/eventscript_tests'

12 years agoMerge remote branch 'martins/eventscripts_relative'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:15:12 +0000 (15:15 +1000)]
Merge remote branch 'martins/eventscripts_relative'

12 years agoMerge remote branch 'martins/test_suite'
Ronnie Sahlberg [Wed, 10 Aug 2011 05:11:00 +0000 (15:11 +1000)]
Merge remote branch 'martins/test_suite'

12 years agoEvenscripts: update 61.cnfs to use ctdb_setup_service_state_dir.
Martin Schwenke [Wed, 15 Dec 2010 21:48:21 +0000 (08:48 +1100)]
Evenscripts: update 61.cnfs to use ctdb_setup_service_state_dir.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 13.per_ip_routing to use ctdb_setup_service_state_dir.
Martin Schwenke [Wed, 15 Dec 2010 21:42:44 +0000 (08:42 +1100)]
Evenscripts: update 13.per_ip_routing to use ctdb_setup_service_state_dir.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEvenscripts: update 20.multipathd to use ctdb_setup_service_state_dir.
Martin Schwenke [Wed, 15 Dec 2010 21:45:28 +0000 (08:45 +1100)]
Evenscripts: update 20.multipathd to use ctdb_setup_service_state_dir.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: fix dangerous rm -rf in 00.ctdb init event.
Martin Schwenke [Fri, 17 Dec 2010 05:23:31 +0000 (16:23 +1100)]
Eventscripts: fix dangerous rm -rf in 00.ctdb init event.

Also remove some unnecessary absolute paths for commands, which were
making the code slightly difficult to read.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: 00.ctdb uses $service_state_dir, neaten update_config_from_tdb().
Martin Schwenke [Fri, 17 Dec 2010 05:21:53 +0000 (16:21 +1100)]
Eventscripts: 00.ctdb uses $service_state_dir, neaten update_config_from_tdb().

This also fixes a bug where update_config_from_tdb() used an incorrect
filename in one place.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years ago00.ctdb eventscript removes all files from $ctdb_active_dir.
Martin Schwenke [Fri, 19 Nov 2010 03:32:28 +0000 (14:32 +1100)]
00.ctdb eventscript removes all files from $ctdb_active_dir.

Without this you can get into a situation where ctdbd can not start.
If the active file for a service exists but the service is not
running, then trying to stop the service may fail, causing the
eventscript to exit from ctdb_start_stop_service().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoScripts: add note about not using absolute command paths to README.
Martin Schwenke [Tue, 28 Jun 2011 07:29:49 +0000 (17:29 +1000)]
Scripts: add note about not using absolute command paths to README.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoAdd a README to the config/ subdirectory.
Martin Schwenke [Tue, 28 Jun 2011 05:19:34 +0000 (15:19 +1000)]
Add a README to the config/ subdirectory.

This includes a comment about using POSIX Bourne shell, including a
suggestion not to use "local" variables.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: new function ctdb_setup_service_state_dir().
Martin Schwenke [Tue, 14 Dec 2010 23:49:48 +0000 (10:49 +1100)]
Eventscript functions: new function ctdb_setup_service_state_dir().

To be used by eventscripts to create a per-service directory for their
own state data.  $service_state_dir is set to point to the new
directory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: new functions to remember/check if service managed.
Martin Schwenke [Tue, 14 Dec 2010 23:45:17 +0000 (10:45 +1100)]
Eventscript functions: new functions to remember/check if service managed.

This was done ad hoc and was badly named.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMerge branch 'test_suite' into ronnie_target
Martin Schwenke [Tue, 9 Aug 2011 03:12:08 +0000 (13:12 +1000)]
Merge branch 'test_suite' into ronnie_target

12 years agoMerge branch 'eventscript_tests' into ronnie_target
Martin Schwenke [Tue, 9 Aug 2011 03:11:38 +0000 (13:11 +1000)]
Merge branch 'eventscript_tests' into ronnie_target

12 years agoTest suite: print debug output after cluster (un)healthy flip-flop on restart.
Martin Schwenke [Tue, 12 Oct 2010 05:49:42 +0000 (16:49 +1100)]
Test suite: print debug output after cluster (un)healthy flip-flop on restart.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoAllow proxy_node to be specified for wait_until_node_has_status().
Martin Schwenke [Fri, 11 Feb 2011 04:13:37 +0000 (15:13 +1100)]
Allow proxy_node to be specified for wait_until_node_has_status().

Default to "any"... but allow specification because sometimes it
matters...

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Fix consistency in 26_ctdb_config_check_error_on_unreachable.
Martin Schwenke [Fri, 11 Feb 2011 04:14:46 +0000 (15:14 +1100)]
Test suite: Fix consistency in 26_ctdb_config_check_error_on_unreachable.

The test currently waits until any node thinks that the test node is
disconnected, and then uses node 0 as a proxy for testing.  However,
nodes may notice at different times that a node is disconnected, so
this test can fail unnecessarily.

We force the proxy node for the wait-until-disconnected to be the same
as the proxy node used to launch the actual tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Fix consistency in 09_ctdb_ping.sh.
Martin Schwenke [Wed, 16 Feb 2011 20:03:19 +0000 (07:03 +1100)]
Test suite: Fix consistency in 09_ctdb_ping.sh.

Same problem as described in commit
283a85b42d9c0a26acb64d5abcc7f175e31e6e75.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Strip architecture suffix from CTDB RPM package version.
Martin Schwenke [Wed, 13 Apr 2011 06:22:02 +0000 (16:22 +1000)]
Test suite: Strip architecture suffix from CTDB RPM package version.

Later versions of RPM seem to include it but we don't want it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: remove getmonmode test.
Martin Schwenke [Wed, 11 May 2011 05:14:16 +0000 (15:14 +1000)]
Test suite: remove getmonmode test.

This can't be made 100% reliable since the monitor mode can change
underneath us due to some event.  Therefore, the test is useless.

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

tests/simple/20_ctdb_getmonmode.sh

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Try much harder to get a healthy cluster when it is restarted.
Martin Schwenke [Tue, 12 Oct 2010 04:10:43 +0000 (15:10 +1100)]
Test suite: Try much harder to get a healthy cluster when it is restarted.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests - Disable the Samba and NFS eventscript tests.
Martin Schwenke [Mon, 8 Aug 2011 06:11:14 +0000 (16:11 +1000)]
Tests - Disable the Samba and NFS eventscript tests.

They're broken and not worth fixing without infrastructure changes so
disable them by taking away the execute bit.  This is somewhat easier
than trying to merge in all the other tests but not these ones.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests - Tweak 10.interfaces 802.ad bonding test to work with current code.
Martin Schwenke [Mon, 8 Aug 2011 05:53:28 +0000 (15:53 +1000)]
Tests - Tweak 10.interfaces 802.ad bonding test to work with current code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoScripts: remove absolute paths from interface_modify.sh.
Martin Schwenke [Tue, 28 Jun 2011 05:17:37 +0000 (15:17 +1000)]
Scripts: remove absolute paths from interface_modify.sh.

The "ip" command is currently run as "/sbin/ip".  This makes it
impossible to replace with a stub in unit testing.  The functions file
controls $PATH, so we don't need absolute paths.

This replaces the absolute paths...

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoScripts: remove absolute paths from interface_modify.sh.
Martin Schwenke [Tue, 28 Jun 2011 05:17:37 +0000 (15:17 +1000)]
Scripts: remove absolute paths from interface_modify.sh.

The "ip" command is currently run as "/sbin/ip".  This makes it
impossible to replace with a stub in unit testing.  The functions file
controls $PATH, so we don't need absolute paths.

This replaces the absolute paths...

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts - Remove local variable usage in 10.interfaces.
Martin Schwenke [Mon, 8 Aug 2011 05:44:30 +0000 (15:44 +1000)]
Eventscripts - Remove local variable usage in 10.interfaces.

POSIX sh doesn't have local variables.  Debian's dash doesn't behave
the same way as bash on this contruct:

  local var=`command that produces multiple words`

It only assigns the 1st word and may print an error.

Just remove the use of the "local" keyword in monitor_interfaces() to
solve this.  It isn't actually limiting the scope of any variables
that are used outside the function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests - implement "ctdb -Y ip -v" in stub for eventscript testing.
Martin Schwenke [Mon, 8 Aug 2011 05:42:45 +0000 (15:42 +1000)]
Tests - implement "ctdb -Y ip -v" in stub for eventscript testing.

This is pretty limited but it gets 10.interfaces tests working.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests - stub ip program should assume interface name if "dev" not specified.
Martin Schwenke [Mon, 8 Aug 2011 04:45:30 +0000 (14:45 +1000)]
Tests - stub ip program should assume interface name if "dev" not specified.

Currently it fails if you don't use the "dev" keyword.

This makes it behave as expected.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: source a file specified by $CTDB_RC_LOCAL in functions file.
Martin Schwenke [Tue, 28 Jun 2011 05:06:10 +0000 (15:06 +1000)]
Eventscripts: source a file specified by $CTDB_RC_LOCAL in functions file.

Another unit testing hook.  This is easier than dropping files into
rc.local.d/ and then removing them.

The file has to be executable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: update tests to work with previous commit.
Martin Schwenke [Tue, 5 Jul 2011 07:12:21 +0000 (17:12 +1000)]
Tests: update tests to work with previous commit.

Issues:

* 10.monitor no longer prints a message when there is no
  public_addresses file.

* Extra bonding test added to check workaround for IEEE 802.3ad
  Dynamic link aggregation bonding mode bug.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.
Martin Schwenke [Thu, 7 Jul 2011 06:17:52 +0000 (16:17 +1000)]
Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.

This sets up a more useful convention and avoids future .gitignore
problems.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: tweak some samba tests to cope with debug from ctdb_check_tcp_ports().
Martin Schwenke [Tue, 5 Jul 2011 02:54:51 +0000 (12:54 +1000)]
Tests: tweak some samba tests to cope with debug from ctdb_check_tcp_ports().

This is a bit too static.  However, it can fixed up later if it is a
hassle.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: Oops! Add bin directory for eventscript tests.
Martin Schwenke [Tue, 5 Jul 2011 02:53:20 +0000 (12:53 +1000)]
Tests: Oops!  Add bin directory for eventscript tests.

It was matched by .gitignore.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoGit should ignore tests/eventscripts/var.x
Martin Schwenke [Tue, 28 Jun 2011 07:30:45 +0000 (17:30 +1000)]
Git should ignore tests/eventscripts/var.x

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: initial eventscript unit tests.
Martin Schwenke [Tue, 28 Jun 2011 07:29:13 +0000 (17:29 +1000)]
Tests: initial eventscript unit tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMerge remote-tracking branch 'origin/master' into eventscripts_relative
Martin Schwenke [Mon, 8 Aug 2011 03:25:40 +0000 (13:25 +1000)]
Merge remote-tracking branch 'origin/master' into eventscripts_relative

12 years agoEventscript functions - use $CTDB_VARDIR instead of local $ctdb_spool_dir.
Martin Schwenke [Tue, 14 Dec 2010 23:21:39 +0000 (10:21 +1100)]
Eventscript functions - use $CTDB_VARDIR instead of local $ctdb_spool_dir.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoio: Make queue_io_read() safe for reentry
David Disseldorp [Sun, 31 Jul 2011 01:14:54 +0000 (03:14 +0200)]
io: Make queue_io_read() safe for reentry

queue_io_read() may be reentered via the queue callback, recoverd is
particularly guilty of this.

queue_io_read() is not safe for reentry if more than one packet is
received and partial chunks follow - data read off the pipe on re-entry
is assumed to be the start-of-packet four byte length. This leads to a
wrongly aligned stream and the notorious "Invalid packet of length 0"
errors.

This change fixes queue_io_read() to be safe under reentry, only a
single packet is processed per call.

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

12 years agoRemove a log message about setting linkstate for an unknown interface.
Ronnie Sahlberg [Fri, 5 Aug 2011 00:03:34 +0000 (10:03 +1000)]
Remove a log message about setting linkstate for an unknown interface.
sometimes we do want to try to set the linkstate for interfaces that are not in use by public addresses right now (but posisbly by other mechanisms) and these messages just spam the logs

S1026357

12 years agoEventscripts - remove some more absolute paths to commands.
Martin Schwenke [Thu, 4 Aug 2011 07:14:11 +0000 (17:14 +1000)]
Eventscripts - remove some more absolute paths to commands.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoremove log message we dont need
Ronnie Sahlberg [Thu, 4 Aug 2011 03:49:02 +0000 (13:49 +1000)]
remove log message we dont need

S1026492

12 years agoremove a non-error logmessage about persistent databases being healthy, as expected
Ronnie Sahlberg [Thu, 4 Aug 2011 03:47:52 +0000 (13:47 +1000)]
remove a non-error logmessage about persistent databases being healthy, as expected

S1026492

12 years agoremove a log message we dont need about "allow clients to attach to databases"
Ronnie Sahlberg [Thu, 4 Aug 2011 03:46:12 +0000 (13:46 +1000)]
remove a log message we dont need about "allow clients to attach to databases"

S1026492

12 years agoChange the message when we start the daemon to "CTDB starting on node"
Ronnie Sahlberg [Thu, 4 Aug 2011 03:44:25 +0000 (13:44 +1000)]
Change the message when we start the daemon to "CTDB starting on node"

S1026492

12 years agoEventscripts - Rework the use of get_proc() for the bonding checks.
Martin Schwenke [Wed, 3 Aug 2011 10:12:48 +0000 (20:12 +1000)]
Eventscripts - Rework the use of get_proc() for the bonding checks.

Call call_proc(), put the output into a variable and then use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: update 60.nfs service() start to use set_proc().
Martin Schwenke [Tue, 28 Jun 2011 05:16:32 +0000 (15:16 +1000)]
Eventscripts: update 60.nfs service() start to use set_proc().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: update 10.interface to use set_proc() and get_proc().
Martin Schwenke [Tue, 28 Jun 2011 05:36:28 +0000 (15:36 +1000)]
Eventscripts: update 10.interface to use set_proc() and get_proc().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: use set_proc() in startstop_nfs().
Martin Schwenke [Tue, 28 Jun 2011 04:58:13 +0000 (14:58 +1000)]
Eventscripts: use set_proc() in startstop_nfs().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: remove unnecessary absolute paths from external commands.
Martin Schwenke [Wed, 13 Apr 2011 02:08:09 +0000 (12:08 +1000)]
Eventscripts: remove unnecessary absolute paths from external commands.

For eventscript unit testing it will be necessary to override external
commands to allow stub implementations to be used.  If absolute paths
aren't used then this can be done using either a fake bin/
subdirectory or by using shell functions.

This removes all of the simple cases of absolute paths.

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

config/ctdb.init
config/events.d/50.samba

        Keep old code but remove absolute paths.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: new functions set_proc() and get_proc().
Martin Schwenke [Tue, 28 Jun 2011 04:54:33 +0000 (14:54 +1000)]
Eventscripts: new functions set_proc() and get_proc().

These provide a thin layer around writing and reading files in /proc.
They can be easily replaced by stubs for unit testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts: remove ctdb_wait_command() and ctdb_wait_tcp_ports() functions.
Martin Schwenke [Wed, 11 May 2011 05:18:11 +0000 (15:18 +1000)]
Eventscripts: remove ctdb_wait_command() and ctdb_wait_tcp_ports() functions.

These haven't been used for a long time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMerge remote branch 'martins/test_suite'
Ronnie Sahlberg [Wed, 3 Aug 2011 06:56:26 +0000 (16:56 +1000)]
Merge remote branch 'martins/test_suite'

12 years agoEventscripts: iptables() should put lock in $CTDB_VARDIR.
Martin Schwenke [Tue, 28 Jun 2011 05:04:58 +0000 (15:04 +1000)]
Eventscripts: iptables() should put lock in $CTDB_VARDIR.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMake Emacs recognise that the eventscript functions file is a shell script.
Martin Schwenke [Wed, 1 Dec 2010 22:48:02 +0000 (09:48 +1100)]
Make Emacs recognise that the eventscript functions file is a shell script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions: add $CTDB_ETCDIR and hook service() functions.
Martin Schwenke [Tue, 7 Jun 2011 05:57:29 +0000 (15:57 +1000)]
Eventscript functions: add $CTDB_ETCDIR and hook service() functions.

* $CTDB_ETCDIR defaults to /etc but can be changed for testing.  All
  hard-coded instances of /etc have been changed to $CTDB_ETCDIR.
  This includes references to /etc/init.d and /etc/sysconfig.

* service() and nice_service() functions now call new function
  _service().  This makes it easier to override these functions (say,
  in rc.local) for testing and call most of the existing functionality
  using _service().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoSet $CTDB_VARDIR in the functions file.
Martin Schwenke [Tue, 14 Dec 2010 23:08:16 +0000 (10:08 +1100)]
Set $CTDB_VARDIR in the functions file.

This will be needed when eventscripts that use it are called
externally.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoMerge remote branch 'martins/onnode_tests'
Ronnie Sahlberg [Wed, 3 Aug 2011 06:26:43 +0000 (16:26 +1000)]
Merge remote branch 'martins/onnode_tests'

12 years agoMerge remote branch 'martins/lcp2_sim'
Ronnie Sahlberg [Wed, 3 Aug 2011 06:25:46 +0000 (16:25 +1000)]
Merge remote branch 'martins/lcp2_sim'

12 years agoTest suite: when the cluster flip-flops (un)healthy, using "ctdb status -Y".
Martin Schwenke [Tue, 28 Sep 2010 04:37:02 +0000 (14:37 +1000)]
Test suite: when the cluster flip-flops (un)healthy, using "ctdb status -Y".

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Print debug info from cluster nodes when time jumps occur.
Martin Schwenke [Fri, 24 Sep 2010 04:34:46 +0000 (14:34 +1000)]
Test suite: Print debug info from cluster nodes when time jumps occur.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: Add debug for cluster (un)healthy flip-flop after restart.
Martin Schwenke [Thu, 23 Sep 2010 05:01:01 +0000 (15:01 +1000)]
Test suite:  Add debug for cluster (un)healthy flip-flop after restart.

We're seeing the cluster become healthy after a restart and then
revert to being unhealthy.  It looks like there's a race and the
cluster shouldn't have been healthy, given that we seem to see that
the monitor cycle hasn't yet been run.

This collects some state debug info from all nodes after the cluster
becomes healthy.  This is printed if the cluster is then unexpectedly
unhealthy a short time later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: add more debug to time jump post mortem.
Martin Schwenke [Tue, 21 Sep 2010 03:34:22 +0000 (13:34 +1000)]
Test suite: add more debug to time jump post mortem.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: add automated checking of time logs.
Martin Schwenke [Thu, 9 Sep 2010 07:21:11 +0000 (17:21 +1000)]
Test suite: add automated checking of time logs.

This depends on the format of onnode output and also depends on
simple/00_ctdb_onnode.sh having been run.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: make time log use seconds since epoch.
Martin Schwenke [Thu, 9 Sep 2010 05:41:03 +0000 (15:41 +1000)]
Test suite: make time log use seconds since epoch.

Easier to implement automatic checking.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: CTDB_SAMBA_SKIP_SHARE_CHECK test now uses _loadconfig().
Martin Schwenke [Tue, 31 Aug 2010 07:48:00 +0000 (17:48 +1000)]
Test suite: CTDB_SAMBA_SKIP_SHARE_CHECK test now uses _loadconfig().

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: CTDB_NFS_SKIP_SHARE_CHECK test now uses _loadconfig().
Martin Schwenke [Tue, 31 Aug 2010 07:44:05 +0000 (17:44 +1000)]
Test suite: CTDB_NFS_SKIP_SHARE_CHECK test now uses _loadconfig().

The manual replacement of loadconfig() had bit rotted and no longer
worked.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: make time logging only happen on a real cluster, not local daemons.
Martin Schwenke [Tue, 31 Aug 2010 07:28:00 +0000 (17:28 +1000)]
Test suite: make time logging only happen on a real cluster, not local daemons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTest suite: add time logging.
Martin Schwenke [Mon, 30 Aug 2010 04:23:29 +0000 (14:23 +1000)]
Test suite: add time logging.

We're seeing some weirdness with CTDB controls timing out.  We're
wondering if time is jumping forward, so this creates a time log on
each node that we can examine later if tests fail weirdly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.
Martin Schwenke [Thu, 7 Jul 2011 06:17:52 +0000 (16:17 +1000)]
Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.

This sets up a more useful convention and avoids future .gitignore
problems.

Resolved conflict while cherry-picking this:

  Don't take the eventscripts files for this branch.  We'll put them
  elsewhere.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: run_tests script no longer prints filename in summary descriptions.
Martin Schwenke [Tue, 7 Jun 2011 06:06:42 +0000 (16:06 +1000)]
Tests: run_tests script no longer prints filename in summary descriptions.

If filenames should be printed in descriptions in the summary then the
descriptions should include the filename.  A better option is to
include something more human-readable that makes the test just as
easily identifiable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: onnode tests changed to use a simple define_test() function.
Martin Schwenke [Tue, 7 Jun 2011 06:05:48 +0000 (16:05 +1000)]
Tests: onnode tests changed to use a simple define_test() function.

This makes global changes easier.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoTests: add initial onnode tests
Martin Schwenke [Wed, 25 May 2011 03:44:17 +0000 (13:44 +1000)]
Tests: add initial onnode tests

Add some simple tests for the onnode command.  These use fake ssh and
ctdb commands that are added to $PATH.  The infrastructure used is
quite flexible and would allow more complex tests to be written.

As-is, these tests expose some bugs in the an older version of onnode
that is included so it can be used to validate some of the tests.

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