[SCM] CTDB repository - branch master updated - ctdb-1.10-320-g20984a2

Ronnie Sahlberg sahlberg at samba.org
Tue Aug 9 23:24:44 MDT 2011


The branch, master has been updated
       via  20984a28d9617c0b7a5868057594920ed3f1a2c7 (commit)
       via  ac164a0d731fc5d46ab7d05112484c45ecb21100 (commit)
       via  cf61c5d1517d3979ce67e7b9bc836d040db8a416 (commit)
       via  92eac08764e87bd3042d2a24ed36b2a339a04960 (commit)
       via  18e0236754507a9475653f04bb239c5d46ba51de (commit)
       via  87e6a4a23a6ae6c276e9628ce513663f47b4ee77 (commit)
       via  5ae002c7513b1b2aa5136437a1a19f8cd179b869 (commit)
       via  a273554791c2a5281aee28f8e2be0c514e14c91e (commit)
       via  9a084a121f629b2c1bcefc1e4c4a4a5cacf53987 (commit)
       via  414c4d8e901353a3529f82746ffe2e4983a155d6 (commit)
       via  432e6c1d5137142ce6b0314a965747524406c17e (commit)
       via  0e14213dfa841080c07fa6fce23b192493adb926 (commit)
       via  c12c97598afcd07ce4876b26e0b734bc825e54c1 (commit)
       via  73cfc304513358e99e6505c95f44a4d319201309 (commit)
       via  7758fd0591467a758e5d22404aa59fcbc1e1cb8b (commit)
       via  6c8eedb21a5e231d4a26ac26706ea51f348a27e0 (commit)
       via  98ccdc6241a73036c4f210bb510f1cb5cff588cc (commit)
       via  91e74cb01a11012e41ef9633c98f13ddbb2e5908 (commit)
       via  151151353e58f59b15be9313e22b7d4f71ee0de8 (commit)
       via  d3271d316f6d1561e66cbc4cc1b1e8af63895459 (commit)
       via  2702592b5911cfa93625e36f4a0d1c4414c0e3e9 (commit)
       via  5b4c712aab3edc0059f2e5a6730b7fdcf7e5f4ec (commit)
       via  95d9a1e19655461288a2c7e52abf9d01ab23e05a (commit)
       via  7130963430e530fa4dd5e6fe132bd7122349cc5f (commit)
       via  4fa2073649f25993de4b8ef6b3e7172068a83a29 (commit)
       via  b13ac3bdaf326a6cdfd87da9195eb9630806c418 (commit)
       via  01c941ab4c764c5aac0d7c0f90fca89775956d41 (commit)
       via  58c696dc600f1073e693930da061776b6fb199f2 (commit)
       via  557ac30e60516742da10b83bfbbbb41430c977a2 (commit)
       via  ef7e5da6241e326267800cd2bd53fb33a0386c2d (commit)
       via  bc94197025a1ec6efaed5586a725f698991b2b17 (commit)
       via  b675ca3c25b7155b9681128822d1280018ef68bb (commit)
       via  b723f23fc9c38e75b91d43306d606be26c55d31d (commit)
       via  d0c6d9b19f0dd8946f9504b0d1cf50dd21f7a592 (commit)
       via  f5b7cb03aaf19fb4b12fc3f0c14d98ee2d7b0798 (commit)
       via  2dfdc997f432d522034922b43cb6f8f878d11ba7 (commit)
       via  70ebb30b90956bb1212287d267ccb72ea83740ca (commit)
       via  61b7f0172ba5c83c847c29fac3582c25c7754b68 (commit)
       via  5a3d5c6b1ca3682bb45104e50061871dec6e9b1d (commit)
       via  05851d50b0078de8bf4691442d718825adca6fe8 (commit)
       via  637f9d8af517b73c72ed8f3cc2a2661f11eb2126 (commit)
       via  f5fd361cadb3ea18d29e2d7215a7853718e48d00 (commit)
       via  3f04793f391c63b78ffb9c9851ab3f0daf3ed50a (commit)
       via  a6dfb76cfa759f6f9409f24368111c4f85ca0fbf (commit)
       via  f43c9a7604b779bb6257ddb2bf3cbe266d496a63 (commit)
       via  ebd53b66b0cc66d9d04830781886234167fc2164 (commit)
      from  9ea41d2fab612772f861270c8a59c01c43bd3a4c (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 20984a28d9617c0b7a5868057594920ed3f1a2c7
Merge: ac164a0d731fc5d46ab7d05112484c45ecb21100 18e0236754507a9475653f04bb239c5d46ba51de
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Aug 10 15:22:46 2011 +1000

    Merge remote branch 'martins/eventscript.13.per_ip_routing'

commit ac164a0d731fc5d46ab7d05112484c45ecb21100
Merge: cf61c5d1517d3979ce67e7b9bc836d040db8a416 151151353e58f59b15be9313e22b7d4f71ee0de8
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Aug 10 15:18:16 2011 +1000

    Merge remote branch 'martins/eventscript_tests'

commit cf61c5d1517d3979ce67e7b9bc836d040db8a416
Merge: 92eac08764e87bd3042d2a24ed36b2a339a04960 2702592b5911cfa93625e36f4a0d1c4414c0e3e9
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Aug 10 15:15:12 2011 +1000

    Merge remote branch 'martins/eventscripts_relative'

commit 92eac08764e87bd3042d2a24ed36b2a339a04960
Merge: 9ea41d2fab612772f861270c8a59c01c43bd3a4c 0e14213dfa841080c07fa6fce23b192493adb926
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Aug 10 15:11:00 2011 +1000

    Merge remote branch 'martins/test_suite'

commit 18e0236754507a9475653f04bb239c5d46ba51de
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 16 08:42:44 2010 +1100

    Evenscripts: update 13.per_ip_routing to use ctdb_setup_service_state_dir.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 87e6a4a23a6ae6c276e9628ce513663f47b4ee77
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 17:29:49 2011 +1000

    Scripts: add note about not using absolute command paths to README.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 5ae002c7513b1b2aa5136437a1a19f8cd179b869
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:19:34 2011 +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 at meltin.net>

commit a273554791c2a5281aee28f8e2be0c514e14c91e
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 15 10:49:48 2010 +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 at meltin.net>

commit 9a084a121f629b2c1bcefc1e4c4a4a5cacf53987
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 15 10:45:17 2010 +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 at meltin.net>

commit 414c4d8e901353a3529f82746ffe2e4983a155d6
Merge: 432e6c1d5137142ce6b0314a965747524406c17e 0e14213dfa841080c07fa6fce23b192493adb926
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 9 13:12:08 2011 +1000

    Merge branch 'test_suite' into ronnie_target

commit 432e6c1d5137142ce6b0314a965747524406c17e
Merge: 2702592b5911cfa93625e36f4a0d1c4414c0e3e9 151151353e58f59b15be9313e22b7d4f71ee0de8
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 9 13:11:38 2011 +1000

    Merge branch 'eventscript_tests' into ronnie_target

commit 0e14213dfa841080c07fa6fce23b192493adb926
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 12 16:49:42 2010 +1100

    Test suite: print debug output after cluster (un)healthy flip-flop on restart.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit c12c97598afcd07ce4876b26e0b734bc825e54c1
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 11 15:13:37 2011 +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 at meltin.net>

commit 73cfc304513358e99e6505c95f44a4d319201309
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 11 15:14:46 2011 +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 at meltin.net>

commit 7758fd0591467a758e5d22404aa59fcbc1e1cb8b
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Feb 17 07:03:19 2011 +1100

    Test suite: Fix consistency in 09_ctdb_ping.sh.
    
    Same problem as described in commit
    283a85b42d9c0a26acb64d5abcc7f175e31e6e75.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 6c8eedb21a5e231d4a26ac26706ea51f348a27e0
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 13 16:22:02 2011 +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 at meltin.net>

commit 98ccdc6241a73036c4f210bb510f1cb5cff588cc
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 11 15:14:16 2011 +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 at meltin.net>
    
    Conflicts:
    
    	tests/simple/20_ctdb_getmonmode.sh
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 91e74cb01a11012e41ef9633c98f13ddbb2e5908
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Oct 12 15:10:43 2010 +1100

    Test suite: Try much harder to get a healthy cluster when it is restarted.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 151151353e58f59b15be9313e22b7d4f71ee0de8
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 16:11:14 2011 +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 at meltin.net>

commit d3271d316f6d1561e66cbc4cc1b1e8af63895459
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 15:53:28 2011 +1000

    Tests - Tweak 10.interfaces 802.ad bonding test to work with current code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 2702592b5911cfa93625e36f4a0d1c4414c0e3e9
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:17:37 2011 +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 at meltin.net>

commit 5b4c712aab3edc0059f2e5a6730b7fdcf7e5f4ec
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:17:37 2011 +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 at meltin.net>

commit 95d9a1e19655461288a2c7e52abf9d01ab23e05a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 15:44:30 2011 +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 at meltin.net>

commit 7130963430e530fa4dd5e6fe132bd7122349cc5f
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 15:42:45 2011 +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 at meltin.net>

commit 4fa2073649f25993de4b8ef6b3e7172068a83a29
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 14:45:30 2011 +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 at meltin.net>

commit b13ac3bdaf326a6cdfd87da9195eb9630806c418
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:06:10 2011 +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 at meltin.net>

commit 01c941ab4c764c5aac0d7c0f90fca89775956d41
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 5 17:12:21 2011 +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 at meltin.net>

commit 58c696dc600f1073e693930da061776b6fb199f2
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 7 16:17:52 2011 +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 at meltin.net>

commit 557ac30e60516742da10b83bfbbbb41430c977a2
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 5 12:54:51 2011 +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 at meltin.net>

commit ef7e5da6241e326267800cd2bd53fb33a0386c2d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 5 12:53:20 2011 +1000

    Tests: Oops!  Add bin directory for eventscript tests.
    
    It was matched by .gitignore.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit bc94197025a1ec6efaed5586a725f698991b2b17
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 17:30:45 2011 +1000

    Git should ignore tests/eventscripts/var.x
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit b675ca3c25b7155b9681128822d1280018ef68bb
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 17:29:13 2011 +1000

    Tests: initial eventscript unit tests.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit b723f23fc9c38e75b91d43306d606be26c55d31d
Merge: d0c6d9b19f0dd8946f9504b0d1cf50dd21f7a592 9ea41d2fab612772f861270c8a59c01c43bd3a4c
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 8 13:25:40 2011 +1000

    Merge remote-tracking branch 'origin/master' into eventscripts_relative

commit d0c6d9b19f0dd8946f9504b0d1cf50dd21f7a592
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 15 10:21:39 2010 +1100

    Eventscript functions - use $CTDB_VARDIR instead of local $ctdb_spool_dir.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit f5b7cb03aaf19fb4b12fc3f0c14d98ee2d7b0798
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Aug 4 17:14:11 2011 +1000

    Eventscripts - remove some more absolute paths to commands.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 2dfdc997f432d522034922b43cb6f8f878d11ba7
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Aug 3 20:12:48 2011 +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 at meltin.net>

commit 70ebb30b90956bb1212287d267ccb72ea83740ca
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:16:32 2011 +1000

    Eventscripts: update 60.nfs service() start to use set_proc().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 61b7f0172ba5c83c847c29fac3582c25c7754b68
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:36:28 2011 +1000

    Eventscripts: update 10.interface to use set_proc() and get_proc().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 5a3d5c6b1ca3682bb45104e50061871dec6e9b1d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 14:58:13 2011 +1000

    Eventscripts: use set_proc() in startstop_nfs().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 05851d50b0078de8bf4691442d718825adca6fe8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Apr 13 12:08:09 2011 +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 at meltin.net>
    
    Conflicts:
    
    	config/ctdb.init
    	config/events.d/50.samba
    
            Keep old code but remove absolute paths.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 637f9d8af517b73c72ed8f3cc2a2661f11eb2126
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 14:54:33 2011 +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 at meltin.net>

commit f5fd361cadb3ea18d29e2d7215a7853718e48d00
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 11 15:18:11 2011 +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 at meltin.net>

commit 3f04793f391c63b78ffb9c9851ab3f0daf3ed50a
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 28 15:04:58 2011 +1000

    Eventscripts: iptables() should put lock in $CTDB_VARDIR.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit a6dfb76cfa759f6f9409f24368111c4f85ca0fbf
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Dec 2 09:48:02 2010 +1100

    Make Emacs recognise that the eventscript functions file is a shell script.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit f43c9a7604b779bb6257ddb2bf3cbe266d496a63
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 7 15:57:29 2011 +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 at meltin.net>

commit ebd53b66b0cc66d9d04830781886234167fc2164
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Dec 15 10:08:16 2010 +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 at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                         |    1 +
 config/README                                      |   37 +
 config/ctdb.init                                   |    8 +-
 config/events.d/00.ctdb                            |   10 +-
 config/events.d/10.interface                       |   34 +-
 config/events.d/13.per_ip_routing                  |   10 +-
 config/events.d/20.multipathd                      |    4 +-
 config/events.d/50.samba                           |   10 +-
 config/events.d/60.ganesha                         |    4 +-
 config/events.d/60.nfs                             |    6 +-
 config/functions                                   |  206 +++---
 config/interface_modify.sh                         |   14 +-
 config/statd-callout                               |   16 +-
 tests/eventscripts/README                          |   43 ++
 tests/eventscripts/common.sh                       |  779 ++++++++++++++++++++
 tests/eventscripts/etc-ctdb/events.d               |    1 +
 tests/eventscripts/etc-ctdb/functions              |    1 +
 tests/eventscripts/etc-ctdb/interface_modify.sh    |    1 +
 tests/eventscripts/etc-ctdb/public_addresses       |    4 +
 tests/eventscripts/etc-ctdb/rc.local               |   46 ++
 .../etc-ctdb/rc.local.nfs.monitor.get-limits       |   25 +
 tests/eventscripts/etc-ctdb/statd-callout          |    5 +
 tests/eventscripts/etc/init.d/nfs                  |    7 +
 tests/eventscripts/etc/init.d/nfslock              |    7 +
 tests/eventscripts/etc/samba/smb.conf              |   42 ++
 tests/eventscripts/etc/sysconfig/nfs               |    2 +
 tests/eventscripts/run_tests.sh                    |   34 +
 tests/eventscripts/simple/10.interface.init.001.sh |   13 +
 tests/eventscripts/simple/10.interface.init.002.sh |   11 +
 .../simple/10.interface.monitor.001.sh             |   13 +
 .../simple/10.interface.monitor.002.sh             |   11 +
 .../simple/10.interface.monitor.003.sh             |   15 +
 .../simple/10.interface.monitor.004.sh             |   15 +
 .../simple/10.interface.monitor.005.sh             |   15 +
 .../simple/10.interface.monitor.006.sh             |   15 +
 .../simple/10.interface.monitor.007.sh             |   13 +
 .../simple/10.interface.monitor.008.sh             |   15 +
 .../simple/10.interface.monitor.009.sh             |   17 +
 .../simple/10.interface.monitor.010.sh             |   19 +
 .../simple/10.interface.monitor.011.sh             |   19 +
 .../simple/10.interface.monitor.012.sh             |   23 +
 .../simple/10.interface.monitor.013.sh             |   15 +
 .../simple/10.interface.releaseip.001.sh           |   13 +
 .../simple/10.interface.releaseip.002.sh           |   17 +
 .../simple/10.interface.startup.001.sh             |   13 +
 .../simple/10.interface.startup.002.sh             |   11 +
 .../eventscripts/simple/10.interface.takeip.001.sh |   13 +
 .../eventscripts/simple/10.interface.takeip.002.sh |   13 +
 .../eventscripts/simple/10.interface.takeip.003.sh |   21 +
 tests/eventscripts/simple/40.vsftpd.monitor.001.sh |   11 +
 tests/eventscripts/simple/41.httpd.monitor.001.sh  |   11 +
 tests/eventscripts/simple/50.samba.monitor.001.sh  |   11 +
 tests/eventscripts/simple/50.samba.monitor.050.sh  |   17 +
 tests/eventscripts/simple/50.samba.monitor.051.sh  |   19 +
 tests/eventscripts/simple/50.samba.monitor.101.sh  |   11 +
 tests/eventscripts/simple/50.samba.monitor.102.sh  |   12 +
 tests/eventscripts/simple/50.samba.monitor.103.sh  |   18 +
 tests/eventscripts/simple/50.samba.monitor.104.sh  |   18 +
 tests/eventscripts/simple/50.samba.monitor.105.sh  |   12 +
 tests/eventscripts/simple/50.samba.monitor.106.sh  |   14 +
 tests/eventscripts/simple/60.nfs.monitor.001.sh    |   11 +
 tests/eventscripts/simple/60.nfs.monitor.100.sh    |   19 +
 tests/eventscripts/simple/60.nfs.monitor.101.sh    |   11 +
 tests/eventscripts/simple/60.nfs.monitor.111.sh    |   12 +
 tests/eventscripts/simple/60.nfs.monitor.112.sh    |   15 +
 tests/eventscripts/simple/60.nfs.monitor.121.sh    |   17 +
 tests/eventscripts/simple/60.nfs.monitor.122.sh    |   19 +
 tests/eventscripts/simple/60.nfs.monitor.131.sh    |   10 +
 tests/eventscripts/simple/60.nfs.monitor.132.sh    |   15 +
 tests/eventscripts/simple/60.nfs.monitor.141.sh    |   15 +
 tests/eventscripts/simple/60.nfs.monitor.142.sh    |   14 +
 tests/eventscripts/simple/60.nfs.monitor.151.sh    |   12 +
 tests/eventscripts/simple/60.nfs.monitor.152.sh    |   18 +
 tests/eventscripts/simple/60.nfs.monitor.153.sh    |   15 +
 tests/eventscripts/stubs/ctdb                      |  166 +++++
 tests/eventscripts/stubs/ethtool                   |   12 +
 tests/eventscripts/stubs/exportfs                  |    7 +
 tests/eventscripts/stubs/ip                        |  205 +++++
 tests/eventscripts/stubs/iptables                  |    5 +
 tests/eventscripts/stubs/kill                      |    7 +
 tests/eventscripts/stubs/killall                   |    7 +
 tests/eventscripts/stubs/net                       |    5 +
 tests/eventscripts/stubs/netstat                   |   99 +++
 tests/eventscripts/stubs/pkill                     |    7 +
 tests/eventscripts/stubs/rpc.lockd                 |    6 +
 tests/eventscripts/stubs/rpc.mountd                |    6 +
 tests/eventscripts/stubs/rpc.rquotad               |    6 +
 tests/eventscripts/stubs/rpc.statd                 |    6 +
 tests/eventscripts/stubs/rpcinfo                   |   79 ++
 tests/eventscripts/stubs/service                   |   64 ++
 tests/eventscripts/stubs/testparm                  |   36 +
 tests/eventscripts/stubs/wbinfo                    |    7 +
 tests/scripts/ctdb_test_functions.bash             |   68 +-
 tests/simple/01_ctdb_version.sh                    |    3 +
 tests/simple/09_ctdb_ping.sh                       |    2 +-
 tests/simple/20_ctdb_getmonmode.sh                 |   59 --
 ..._ctdb_config_check_error_on_unreachable_ctdb.sh |    2 +-
 97 files changed, 2656 insertions(+), 252 deletions(-)
 create mode 100644 config/README
 mode change 100644 => 100755 config/events.d/20.multipathd
 mode change 100644 => 100755 config/events.d/60.ganesha
 create mode 100644 tests/eventscripts/README
 create mode 100644 tests/eventscripts/common.sh
 create mode 120000 tests/eventscripts/etc-ctdb/events.d
 create mode 120000 tests/eventscripts/etc-ctdb/functions
 create mode 120000 tests/eventscripts/etc-ctdb/interface_modify.sh
 create mode 100644 tests/eventscripts/etc-ctdb/public_addresses
 create mode 100755 tests/eventscripts/etc-ctdb/rc.local
 create mode 100755 tests/eventscripts/etc-ctdb/rc.local.nfs.monitor.get-limits
 create mode 100755 tests/eventscripts/etc-ctdb/statd-callout
 create mode 100755 tests/eventscripts/etc/init.d/nfs
 create mode 100755 tests/eventscripts/etc/init.d/nfslock
 create mode 100644 tests/eventscripts/etc/samba/smb.conf
 create mode 100644 tests/eventscripts/etc/sysconfig/nfs
 create mode 100755 tests/eventscripts/run_tests.sh
 create mode 100755 tests/eventscripts/simple/10.interface.init.001.sh
 create mode 100755 tests/eventscripts/simple/10.interface.init.002.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.001.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.002.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.003.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.004.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.005.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.006.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.007.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.008.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.009.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.010.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.011.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.012.sh
 create mode 100755 tests/eventscripts/simple/10.interface.monitor.013.sh
 create mode 100755 tests/eventscripts/simple/10.interface.releaseip.001.sh
 create mode 100755 tests/eventscripts/simple/10.interface.releaseip.002.sh
 create mode 100755 tests/eventscripts/simple/10.interface.startup.001.sh
 create mode 100755 tests/eventscripts/simple/10.interface.startup.002.sh
 create mode 100755 tests/eventscripts/simple/10.interface.takeip.001.sh
 create mode 100755 tests/eventscripts/simple/10.interface.takeip.002.sh
 create mode 100755 tests/eventscripts/simple/10.interface.takeip.003.sh
 create mode 100755 tests/eventscripts/simple/40.vsftpd.monitor.001.sh
 create mode 100755 tests/eventscripts/simple/41.httpd.monitor.001.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.001.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.050.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.051.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.101.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.102.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.103.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.104.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.105.sh
 create mode 100644 tests/eventscripts/simple/50.samba.monitor.106.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.001.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.100.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.101.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.111.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.112.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.121.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.122.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.131.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.132.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.141.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.142.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.151.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.152.sh
 create mode 100644 tests/eventscripts/simple/60.nfs.monitor.153.sh
 create mode 100755 tests/eventscripts/stubs/ctdb
 create mode 100755 tests/eventscripts/stubs/ethtool
 create mode 100755 tests/eventscripts/stubs/exportfs
 create mode 100755 tests/eventscripts/stubs/ip
 create mode 100755 tests/eventscripts/stubs/iptables
 create mode 100755 tests/eventscripts/stubs/kill
 create mode 100755 tests/eventscripts/stubs/killall
 create mode 100755 tests/eventscripts/stubs/net
 create mode 100755 tests/eventscripts/stubs/netstat
 create mode 100755 tests/eventscripts/stubs/pkill
 create mode 100755 tests/eventscripts/stubs/rpc.lockd
 create mode 100755 tests/eventscripts/stubs/rpc.mountd
 create mode 100755 tests/eventscripts/stubs/rpc.rquotad
 create mode 100755 tests/eventscripts/stubs/rpc.statd
 create mode 100755 tests/eventscripts/stubs/rpcinfo
 create mode 100755 tests/eventscripts/stubs/service
 create mode 100755 tests/eventscripts/stubs/testparm
 create mode 100755 tests/eventscripts/stubs/wbinfo
 delete mode 100755 tests/simple/20_ctdb_getmonmode.sh


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 063e1ed..ef8ae6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,4 @@ tests/bin
 tests/events.d/00.ctdb_test_trigger
 tests/var
 tests/takeover/ctdb_takeover.pyc
+tests/eventscripts/var
diff --git a/config/README b/config/README
new file mode 100644
index 0000000..f2457a7
--- /dev/null
+++ b/config/README
@@ -0,0 +1,37 @@
+This directory contains run-time support scripts for CTDB.
+
+Selected highlights:
+
+  ctdb.init
+
+    An initscript for starting ctdbd at boot time.
+
+  events.d/
+
+    Eventscripts.  See events.d/README for more details.
+
+  functions
+
+    Support functions, sourced by eventscripts and other scripts.
+
+  interface_modify.sh
+
+    Script to support add/remove IPs and other funky stuff.  Not sure
+    why this is separate... but it certainly allows easy wrapping by
+    flock.
+
+  statd-callout
+
+    rpc.statd high-availability callout to support lock migration on
+    failover.
+
+Notes:
+
+* All of these scripts are written in POSIX Bourne shell.  Please
+  avoid bash-isms, including the use of "local" variables (which are
+  not available in POSIX shell).
+
+* Do not use absolute paths for commands.  Unit tests attempt to
+  replace many commands with stubs and can not do this if commands are
+  specified with absolute paths.  The functions file controls $PATH so
+  absolute paths should not be required.
diff --git a/config/ctdb.init b/config/ctdb.init
index 1dc051c..9e32bac 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -39,10 +39,6 @@ unset TMPDIR
     export CTDB_BASE="/etc/ctdb"
 }
 
-[ -z "$CTDB_VARDIR" ] && {
-    export CTDB_VARDIR="/var/ctdb"
-}
-
 . $CTDB_BASE/functions
 loadconfig network
 loadconfig ctdb
@@ -118,7 +114,7 @@ check_tdb () {
 		#
 		# Note tdbtool always exits with 0
 		#
-		local OK=`/usr/bin/tdbtool $PDBASE check | grep "Database integrity is OK" | wc -l`
+		local OK=`tdbtool $PDBASE check | grep "Database integrity is OK" | wc -l`
 		test x"$OK" = x"1" || {
 			return 1;
 		}
@@ -126,7 +122,7 @@ check_tdb () {
 		return 0;
 	}
 
-	/usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
+	tdbdump $PDBASE >/dev/null 2>/dev/null || {
 		return $?;
 	}
 
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 4f97185..9df5af4 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -33,10 +33,10 @@ update_config_from_tdb() {
 case "$1" in 
      init)
         # make sure we have a blank state directory for the scripts to work with
-	/bin/rm -rf $CTDB_VARDIR/state
-	/bin/mkdir -p $CTDB_VARDIR/state || {
+	rm -rf $CTDB_VARDIR/state
+	mkdir -p $CTDB_VARDIR/state || {
 	    ret=$?
-	    echo "/bin/mkdir -p $CTDB_VARDIR/state - failed - $ret"
+	    echo "mkdir -p $CTDB_VARDIR/state - failed - $ret"
 	    exit $ret
 	}
 	;;
@@ -67,7 +67,7 @@ case "$1" in
 
 	# warn when we get low on memory
 	[ -z "$CTDB_MONITOR_FREE_MEMORY_WARN" ] || {
-		FREE_MEM=`free -m | grep "buffers/cache" | while read A B C D ;do /bin/echo -n $D ; done`
+		FREE_MEM=`free -m | grep "buffers/cache" | while read A B C D ;do echo -n $D ; done`
 		[ `expr "$FREE_MEM" "<" "$CTDB_MONITOR_FREE_MEMORY_WARN"` != "0" ] && {
 			echo "Running low on memory. Free:$FREE_MEM while CTDB treshold is $CTDB_MONITOR_FREE_MEMORY_WARN"
 		}
@@ -75,7 +75,7 @@ case "$1" in
 
 	# monitor that we are not running out of memory
 	[ -z "$CTDB_MONITOR_FREE_MEMORY" ] || {
-		FREE_MEM=`free -m | grep "buffers/cache" | while read A B C D ;do /bin/echo -n $D ; done`
+		FREE_MEM=`free -m | grep "buffers/cache" | while read A B C D ;do echo -n $D ; done`
 		[ `expr "$FREE_MEM" "<" "$CTDB_MONITOR_FREE_MEMORY"` != "0" ] && {
 			echo "OOM. Free:$FREE_MEM while CTDB treshold is $CTDB_MONITOR_FREE_MEMORY"
 			cat /proc/meminfo
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index ecaa323..b912ab3 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -18,7 +18,7 @@ loadconfig
 
 monitor_interfaces()
 {
-	local INTERFACES=`cat $CTDB_PUBLIC_ADDRESSES |
+	INTERFACES=`cat $CTDB_PUBLIC_ADDRESSES |
 		sed -e "s/^[^\t ]*[\t ]*//" -e "s/,/ /g" -e "s/[\t ]*$//"`
 
 	[ "$CTDB_PUBLIC_INTERFACE" ] && INTERFACES="$CTDB_PUBLIC_INTERFACE $INTERFACES"
@@ -27,14 +27,12 @@ monitor_interfaces()
 
 	# For all but the 1st line, get the 2nd last field with commas
 	# changes to spaces.
-	local IFACES=`ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g'`
-
-	local IFACE
+	IFACES=`ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g'`
 
 	INTERFACES=`for IFACE in $INTERFACES $IFACES ; do echo $IFACE ; done | sort | uniq`
 
-	local fail=0
-	local ok=0
+	fail=0
+	ok=0
 	for IFACE in $INTERFACES ; do
 
 	    ip addr show $IFACE 2>/dev/null >/dev/null || {
@@ -45,22 +43,22 @@ monitor_interfaces()
 	    # These interfaces are sometimes bond devices
 	    # When we use VLANs for bond interfaces, there will only
 	    # be an entry in /proc for the underlying real interface
-	    local REALIFACE=`echo $IFACE |sed -e 's/\..*$//'`
-	    [ -f /proc/net/bonding/$REALIFACE ] && {
-		grep -q 'Currently Active Slave: None' /proc/net/bonding/$REALIFACE && {
+	    REALIFACE=`echo $IFACE |sed -e 's/\..*$//'`
+	    bi=$(get_proc "net/bonding/$REALIFACE") 2>/dev/null && {
+		echo "$bi" | grep -q 'Currently Active Slave: None' && {
 			echo "ERROR: No active slaves for bond device $REALIFACE"
 			fail=1
 			ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
 			continue;
 		}
-		grep -q '^MII Status: up' /proc/net/bonding/$REALIFACE || {
+		echo "$bi" | grep -q '^MII Status: up' || {
 			echo "ERROR: public network interface $REALIFACE is down"
 			fail=1
 			ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
 			continue;
 		}
-		grep -q '^Bonding Mode: IEEE 802.3ad Dynamic link aggregation' /proc/net/bonding/$REALIFACE && {
-			grep 'MII Status:' /proc/net/bonding/$REALIFACE | tail -n +2 | grep -q '^MII Status: up' || {
+		echo "$bi" | grep -q '^Bonding Mode: IEEE 802.3ad Dynamic link aggregation' && {
+			echo "$bi" | grep 'MII Status:' | tail -n +2 | grep -q '^MII Status: up' || {
 				echo No active slaves for 802.ad bond device $REALIFACE
 				ctdb setifacelink $IFACE down >/dev/null 2>/dev/null
 				fail=1
@@ -91,7 +89,7 @@ monitor_interfaces()
 			# cable is plugged but the interface has not been
 			# brought up previously. Bring the interface up and
 			# try again...
-			/sbin/ip link set $IFACE up
+			ip link set $IFACE up
 			ethtool $IFACE | grep -q 'Link detected: yes' || {
 			    echo "ERROR: No link on the public network interface $IFACE"
 			    fail=1
@@ -124,8 +122,8 @@ case "$1" in
      init)
 	# make sure that we only respond to ARP messages from the NIC where
 	# a particular ip address is associated.
-	[ -f /proc/sys/net/ipv4/conf/all/arp_filter ] && {
-	    echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
+	get_proc sys/net/ipv4/conf/all/arp_filter >/dev/null 2>&1 && {
+	    set_proc sys/net/ipv4/conf/all/arp_filter 1
 	}
 	;;
 
@@ -164,7 +162,7 @@ case "$1" in
 	iptables -D INPUT -i $iface -d $ip -j DROP 2> /dev/null
 
 	# flush our route cache
-	echo 1 > /proc/sys/net/ipv4/route/flush
+	set_proc sys/net/ipv4/route/flush 1
 	;;
 
 
@@ -204,7 +202,7 @@ case "$1" in
 	iptables -D INPUT -i $iface -d $ip -j DROP 2> /dev/null
 
 	# flush our route cache
-	echo 1 > /proc/sys/net/ipv4/route/flush
+	set_proc sys/net/ipv4/route/flush 1
 	;;
 
      ##################################################
@@ -248,7 +246,7 @@ case "$1" in
 	iptables -D INPUT -i $oiface -d $ip -j DROP 2> /dev/null
 
 	# flush our route cache
-	echo 1 > /proc/sys/net/ipv4/route/flush
+	set_proc sys/net/ipv4/route/flush 1
 
 	# propagate the new mac address
 	ctdb gratiousarp $ip $niface
diff --git a/config/events.d/13.per_ip_routing b/config/events.d/13.per_ip_routing
index c734bbc..ff4dbdb 100755
--- a/config/events.d/13.per_ip_routing
+++ b/config/events.d/13.per_ip_routing
@@ -3,8 +3,10 @@
 . $CTDB_BASE/functions
 loadconfig
 
+ctdb_setup_service_state_dir "per_ip_routing"
+
 [ -z "$CTDB_PER_IP_ROUTING_STATE" ] && {
-	CTDB_PER_IP_ROUTING_STATE="$CTDB_VARDIR/state/per_ip_routing"
+	CTDB_PER_IP_ROUTING_STATE="$service_state_dir"
 }
 
 AUTO_LINK_LOCAL="no"
@@ -75,14 +77,14 @@ lock_file() {
 			stat -c%y "$lckf"
 			return 1
 		}
-		/bin/kill -0 $pid && {
+		kill -0 $pid && {
 			lock_debug "lock file $lckf is valid for process $pid"
 			stat -c%y "$lckf"
 			return 1
 		}
 		lock_debug "stale lock file $lckf for $machine:$pid"
 		cat "$lckf"
-		/bin/rm -f "$lckf"
+		rm -f "$lckf"
 	fi
 	echo "$host:$$" > "$lckf"
 	return 0
@@ -99,7 +101,7 @@ unlock_file() {
 		lock_debug "lock nesting now $locknesting"
 	else
 		lckf="$lock_root/$1"
-		/bin/rm -f "$lckf"
+		rm -f "$lckf"
 	fi
 }
 
diff --git a/config/events.d/20.multipathd b/config/events.d/20.multipathd
old mode 100644
new mode 100755
index 2f484a4..73b6054
--- a/config/events.d/20.multipathd
+++ b/config/events.d/20.multipathd
@@ -49,7 +49,7 @@ multipathd_check()
 		timeleft=$(($timeleft - 1))
 
 		# see if the process still exists
-		/bin/kill -0 $pid > /dev/null 2>&1 || {
+		kill -0 $pid > /dev/null 2>&1 || {
 			# it doesn't exist, grab its exit status
 			wait $pid
 			[ $? = 0 ] || {
@@ -78,7 +78,7 @@ case "$1" in
     startup)
 	# create a state directory to keep/track the multipath device
 	# state
-	/bin/mkdir -p $CTDB_VARDIR/state/multipathd
+	mkdir -p $CTDB_VARDIR/state/multipathd
 	exit 0
 	;;
 
diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 7a152b5..3e90742 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -32,7 +32,7 @@ loadconfig
 
 start_samba() {
 	# create the state directory for samba
-	/bin/mkdir -p $CTDB_VARDIR/state/samba
+	mkdir -p $CTDB_VARDIR/state/samba
 
 	# make sure samba is not already started
 	[ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
@@ -76,7 +76,7 @@ start_samba() {
 	# the number of smbd processes will mean that it leaves few cycles for
 	# anything else
 	[ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
-		/usr/bin/net serverid wipe
+		net serverid wipe
 
 		nice_service "$CTDB_SERVICE_NMB" start || {
 			echo failed to start nmbd
@@ -141,7 +141,7 @@ testparm_background_update() {
 	while [ $timeleft -gt 0 ]; do
 	    timeleft=$(($timeleft - 1))
 	    # see if the process still exists
-	    /bin/kill -0 $pid > /dev/null 2>&1 || {
+	    kill -0 $pid > /dev/null 2>&1 || {
 		# it doesn't exist, grab its exit status
 		wait $pid
 		[ $? = 0 ] || {
@@ -167,7 +167,7 @@ testparm_background_update() {
 	done
 	# it took more than 10 seconds - kill it off
 	rm -f "${tmpfile}"
-	/bin/kill -9 "$pid" > /dev/null 2>&1
+	kill -9 "$pid" > /dev/null 2>&1
 	echo "50.samba: timed out updating smbconf cache in background"
 	exit 1
     ) &
@@ -241,7 +241,7 @@ case "$1" in
 	[ -f $CTDB_VARDIR/state/samba/periodic_cleanup ] || {
 		touch $CTDB_VARDIR/state/samba/periodic_cleanup
 	}
-	[ `/usr/bin/find $CTDB_VARDIR/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
+	[ `find $CTDB_VARDIR/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
 		# Cleanup the databases
 	    	periodic_cleanup
 		touch $CTDB_VARDIR/state/samba/periodic_cleanup
diff --git a/config/events.d/60.ganesha b/config/events.d/60.ganesha
old mode 100644
new mode 100755
index 6559dd0..fb3b7c2
--- a/config/events.d/60.ganesha
+++ b/config/events.d/60.ganesha
@@ -2,8 +2,8 @@
 # script to manage nfs in a clustered environment
 
 start_nfs() {
-       /bin/mkdir -p $CTDB_VARDIR/state/nfs
-       /bin/mkdir -p $CTDB_VARDIR/state/statd/ip
+       mkdir -p $CTDB_VARDIR/state/nfs
+       mkdir -p $CTDB_VARDIR/state/statd/ip
        ctdb_service_stop
        ctdb_service_start
        echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
diff --git a/config/events.d/60.nfs b/config/events.d/60.nfs
index 0cea531..6736a9c 100755
--- a/config/events.d/60.nfs
+++ b/config/events.d/60.nfs
@@ -2,11 +2,11 @@
 # script to manage nfs in a clustered environment
 
 start_nfs() {
-	/bin/mkdir -p $CTDB_VARDIR/state/nfs
-	/bin/mkdir -p $CTDB_VARDIR/state/statd/ip
+	mkdir -p $CTDB_VARDIR/state/nfs
+	mkdir -p $CTDB_VARDIR/state/statd/ip
 	startstop_nfs stop
 	startstop_nfs start
-	echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
+	set_proc "sys/net/ipv4/tcp_tw_recycle" 1
 }
 
 . $CTDB_BASE/functions
diff --git a/config/functions b/config/functions
index 6c44fb8..32f11f0 100755
--- a/config/functions
+++ b/config/functions
@@ -1,7 +1,16 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!
+
 # utility functions for ctdb event scripts
 
 PATH=/bin:/usr/bin:/usr/sbin:/sbin:$PATH
 
+[ -z "$CTDB_VARDIR" ] && {
+    export CTDB_VARDIR="/var/ctdb"
+}
+[ -z "$CTDB_ETCDIR" ] && {
+    export CTDB_ETCDIR="/etc"
+}
+
 #######################################
 # pull in a system config file, if any
 _loadconfig() {
@@ -15,11 +24,10 @@ _loadconfig() {
 	loadconfig "ctdb"
     fi
 
-
-    if [ -f /etc/sysconfig/$1 ]; then
-	. /etc/sysconfig/$1
-    elif [ -f /etc/default/$1 ]; then
-	. /etc/default/$1
+    if [ -f $CTDB_ETCDIR/sysconfig/$1 ]; then
+	. $CTDB_ETCDIR/sysconfig/$1
+    elif [ -f $CTDB_ETCDIR/default/$1 ]; then
+	. $CTDB_ETCDIR/default/$1
     elif [ -f $CTDB_BASE/sysconfig/$1 ]; then
 	. $CTDB_BASE/sysconfig/$1
     fi
@@ -46,7 +54,10 @@ detect_init_style() {
 
 ######################################################
 # simulate /sbin/service on platforms that don't have it
-service() { 
+# _service() makes it easier to hook the service() function for
+# testing.
+_service ()
+{
   _service_name="$1"
   _op="$2"
 
@@ -54,91 +65,46 @@ service() {
   [ -z "$_service_name" ] && return
 
   if [ -x /sbin/service ]; then
-      /sbin/service "$_service_name" "$_op"
-  elif [ -x /etc/init.d/$_service_name ]; then
-      /etc/init.d/$_service_name "$_op"
-  elif [ -x /etc/rc.d/init.d/$_service_name ]; then
-      /etc/rc.d/init.d/$_service_name "$_op"
+      $_nice /sbin/service "$_service_name" "$_op"
+  elif [ -x $CTDB_ETCDIR/init.d/$_service_name ]; then
+      $_nice $CTDB_ETCDIR/init.d/$_service_name "$_op"
+  elif [ -x $CTDB_ETCDIR/rc.d/init.d/$_service_name ]; then
+      $_nice $CTDB_ETCDIR/rc.d/init.d/$_service_name "$_op"
   fi
 }
 
+service()
+{
+    _nice=""
+    _service "$@"
+}
+
 ######################################################
 # simulate /sbin/service (niced) on platforms that don't have it
-nice_service() { 
-  _service_name="$1"
-  _op="$2"
-
-  # do nothing, when no service was specified
-  [ -z "$_service_name" ] && return
-
-  if [ -x /sbin/service ]; then
-      nice /sbin/service "$_service_name" "$_op"
-  elif [ -x /etc/init.d/$_service_name ]; then
-      nice /etc/init.d/$_service_name "$_op"
-  elif [ -x /etc/rc.d/init.d/$_service_name ]; then
-      nice /etc/rc.d/init.d/$_service_name "$_op"
-  fi
+nice_service()
+{
+    _nice="nice"
+    _service "$@"
 }
 
 ######################################################
-# wait for a command to return a zero exit status
-# usage: ctdb_wait_command SERVICE_NAME <command>
-######################################################
-ctdb_wait_command() {
-  service_name="$1"
-  wait_cmd="$2"
-  [ -z "$wait_cmd" ] && return;
-  all_ok=0
-  echo "Waiting for service $service_name to start"
-  while [ $all_ok -eq 0 ]; do
-	  $wait_cmd > /dev/null 2>&1 && all_ok=1
-	  ctdb status > /dev/null 2>&1 || {
-  		echo "ctdb daemon has died. Exiting wait for $service_name"
-		exit 1
-	  }
-	  [ $all_ok -eq 1 ] || sleep 1
-  done
-  echo "Local service $service_name is up"
+# wrapper around /proc/ settings to allow them to be hooked
+# for testing
+# 1st arg is relative path under /proc/, 2nd arg is value to set
+set_proc ()
+{
+    echo "$2" >"/proc/$1"
 }
 


-- 
CTDB repository


More information about the samba-cvs mailing list