David Disseldorp [Mon, 8 Aug 2011 14:35:56 +0000 (16:35 +0200)]
client: add timeout argument to ctdb_attach
Rather than using a fixed 2 second CTDB_CONTROL_GETDBPATH timeout.
(This used to be ctdb commit
9e178671560cb95121e11d718a76b05380ecd6c5)
David Disseldorp [Mon, 8 Aug 2011 12:09:46 +0000 (14:09 +0200)]
client: add req timeout argument to ctdb_cmdline_client
Following connection to the local ctdbd, ctdb_cmdline_client() currently
issues a CTDB_CONTROL_GET_PNN request with a fixed 3 second timeout.
The ctdb cmd line client accepts a --timelimit argument for specifying
a per request timeout, pass this value through to ctdb_cmdline_client()
for use as a CTDB_CONTROL_GET_PNN request timeout.
(This used to be ctdb commit
0634d0305f42f17048b6830733767e8dc300e11c)
Ronnie Sahlberg [Mon, 5 Sep 2011 06:42:49 +0000 (16:42 +1000)]
Merge branch 'master' of ssh://git.samba.org/data/git/ctdb
(This used to be ctdb commit
32320ee278d1eec9aef18b400c0ddaa445d4211e)
Michael Adam [Fri, 2 Sep 2011 14:42:10 +0000 (16:42 +0200)]
Add a tunable "AllowClientDBAttach" with default value 1.
When set to 0, clients will not be able to attach to databases
via the db_attach control. This might can be useful for maintenance
where ctdb should be kept running but clients should not be able
to modify databases.
(This used to be ctdb commit
ddfeecda87955b4e46777599f678e6926d37f4c4)
Michael Adam [Fri, 2 Sep 2011 14:23:22 +0000 (16:23 +0200)]
tools/ctdb: fix a typo in a debug message
(This used to be ctdb commit
9bded1832179fbadc8bc94c5328ffa6c45a6d2ab)
Ronnie Sahlberg [Fri, 2 Sep 2011 03:31:41 +0000 (13:31 +1000)]
tests:ctdb_fetch_lock_once we must link with @POPT_OBJ@ in case -lpopt is not available
(This used to be ctdb commit
cdbc800a776f213cfd0ed543cee85b0d1714a186)
Ronnie Sahlberg [Fri, 2 Sep 2011 03:21:33 +0000 (13:21 +1000)]
tests: Link ctdb_fetch_lock_once with @TDB_OBJ@ not -ltdb so we dont create an unneeded dependency on having a standalone tdb library installed
(This used to be ctdb commit
9118b9cf1634866266fbf0a9bf857a622f994a1a)
Ronnie Sahlberg [Thu, 1 Sep 2011 02:30:00 +0000 (12:30 +1000)]
New version 1.11
(This used to be ctdb commit
ee9bf1565383bcca70950e9c20fe6b4d0181ce8d)
Ronnie Sahlberg [Wed, 31 Aug 2011 22:55:23 +0000 (08:55 +1000)]
Merge remote branch 'martins/tests'
(This used to be ctdb commit
71080adfe0828e15bf2f4b0bee7d52e06fff3449)
Ronnie Sahlberg [Wed, 31 Aug 2011 22:52:48 +0000 (08:52 +1000)]
Merge remote branch 'martins/eventscripts'
(This used to be ctdb commit
1bb814f012cb6ce436f8748b06602e8d6fae8822)
Martin Schwenke [Wed, 31 Aug 2011 07:29:14 +0000 (17:29 +1000)]
Tests - eventscripts - add some multievent tests
Running "./run_tests -s simple/* multievent/*" results in a stupid
summary. Will need to work on that...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
999c68948da1492ac4d728c6bf79ad4921d9e840)
Martin Schwenke [Wed, 31 Aug 2011 07:27:05 +0000 (17:27 +1000)]
Tests - eventscripts - allow "ctdb scriptstatus" output to be primed
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
f527ffb55b514b5cb4df3471a0e17ab71307e8a1)
Martin Schwenke [Wed, 31 Aug 2011 05:38:55 +0000 (15:38 +1000)]
Merge branch 'eventscripts' into tests
(This used to be ctdb commit
1c9dadf02ca649e3f09d9edd778bf13e001aa849)
Martin Schwenke [Wed, 31 Aug 2011 05:34:43 +0000 (15:34 +1000)]
Eventscripts - enhance ctdb_replay_monitor_status()
Print useful output and return a suitable exit code.
The DISABLED and TIMEDOUT statuses use fake negative return codes, and
these can't be faked from the shell. So we map DISABLED to OK and
TIMEDOUT to ERROR - this should avoid nearly all surprises. When we
do this we add a note to the beginning of the output. The alternative
is to "fix" ctdbd to use only codes that can actually be returned by
shell scripts. However, the reason for using negative codes is
probably to distinguish them from real ones...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
dda44d026e0c1b02feb02185b8c200a542be341a)
Martin Schwenke [Tue, 30 Aug 2011 06:27:04 +0000 (16:27 +1000)]
Tests - eventscripts - ctdb stub - implement scriptstatus, tweaks
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
edc34d01a1ad83b1335c976593a006166b196569)
Martin Schwenke [Tue, 30 Aug 2011 06:25:13 +0000 (16:25 +1000)]
Tests - eventscripts - formatting tweak in simple_test()
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
698af79545986cf788686feb06c4677a10eec770)
Martin Schwenke [Tue, 30 Aug 2011 04:21:02 +0000 (14:21 +1000)]
Tests - eventscripts - new function simple_test_event()
Just like simple_test() but 1st arg is the event name.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
69e240e15488e228c0232fdc8804af778cb4e6fc)
Martin Schwenke [Tue, 30 Aug 2011 04:20:38 +0000 (14:20 +1000)]
Tests - eventscripts - output format tweaks
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
8f8dc5636436db28ce7d0edd706a4adf2624e71b)
Martin Schwenke [Tue, 30 Aug 2011 04:19:09 +0000 (14:19 +1000)]
Tests - eventscripts - add extra filename format for multi-event tests
$event may not be set so we need to test for it.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
80f14e590242b14829c6309ee908af0f2d33be1e)
Martin Schwenke [Tue, 30 Aug 2011 04:16:28 +0000 (14:16 +1000)]
Tests - eventscripts - add die() function and use it
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
0446eaa7798fd0ddf8d8f067c56d19892a13a317)
Martin Schwenke [Tue, 30 Aug 2011 03:35:43 +0000 (13:35 +1000)]
Tests - eventscripts - remove undefined argument in some simple_test calls
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
c490024aba39cf94cbc9f8f41ecb3d336b1c82a8)
Martin Schwenke [Tue, 23 Aug 2011 03:53:39 +0000 (13:53 +1000)]
Tests - evenscripts - add symlink to ctdb.sysconfig
Some of the tests expect the default to be
CTDB_SERVICE_AUTOSTARTSTOP=yes
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
f7de037e3be2e9910bee644dd1e93bae4912a194)
Martin Schwenke [Tue, 23 Aug 2011 03:52:42 +0000 (13:52 +1000)]
Tests - eventscripts - Samba TCP port checking fixes
Expect "ctdb checktcpport" to exit with 1 if not implemented.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
20885d592040eb3945524c558b593a1d50a57b43)
Martin Schwenke [Mon, 22 Aug 2011 06:41:01 +0000 (16:41 +1000)]
Tests - eventscripts - TCP port checking, no working checkers
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
b231aa629b909a7dfd071236c7e730e3cc4a1a54)
Martin Schwenke [Mon, 22 Aug 2011 06:37:22 +0000 (16:37 +1000)]
Tests - eventscripts - new Samba TCP port checking test - no nmap
This one should fall back to netstat.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
0a08068f736efe56b4799e1f1f90539d257deb71)
Martin Schwenke [Mon, 22 Aug 2011 06:14:55 +0000 (16:14 +1000)]
Tests - eventscripts - nmap and netstat stubs can pretend they weren't found
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
47f2843b4db767bcc724d8f972e0c2a850d5826f)
Martin Schwenke [Mon, 22 Aug 2011 06:10:44 +0000 (16:10 +1000)]
Tests - eventscripts - new Samba tests to test TCP port checking
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
9e3e6ab3edf0f79d5973eb39ed843d3c369c665d)
Martin Schwenke [Mon, 22 Aug 2011 06:06:16 +0000 (16:06 +1000)]
Tests - eventscripts - add a new ctdb_not_implemented() function
This allowed a single ctdb command to be defined as not-implemented
and provided the associated output from the ctdb stub in
$ctdb_not_implemented.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
3852c091f5e0ecba06b7131ca04b73a0cd632f23)
Martin Schwenke [Mon, 22 Aug 2011 06:00:52 +0000 (16:00 +1000)]
Tests - eventscripts - new function setup_nmap_output_filter()
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
ef6131ecb068f7d8402cc782359509ba54b5adb0)
Martin Schwenke [Mon, 22 Aug 2011 06:07:36 +0000 (16:07 +1000)]
Tests - eventscripts - add some output filtering
This allows $OUT_FILTER to be set to one or more sed commands to
filter eventscript output. This allows expected output to be
generalised.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
a1d424045c53f5b148952eade6161af8248ed4df)
Martin Schwenke [Mon, 22 Aug 2011 05:59:20 +0000 (15:59 +1000)]
Tests - eventscripts - ctdb default default level is 0.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
fcf40500c2158dfbe2390fad7bf0614cc575df14)
Martin Schwenke [Mon, 22 Aug 2011 05:58:23 +0000 (15:58 +1000)]
Tests - eventscripts - add output for "not implemented" in ctdb stub
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
1d02e3c6a7fb5ad5edb21298deba415ba9519f3d)
Martin Schwenke [Mon, 22 Aug 2011 05:56:57 +0000 (15:56 +1000)]
Tests - eventscripts - add an nmap stub
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
6ff9545a0fd58f0728b769c7b36d3b6ab7366321)
Martin Schwenke [Fri, 19 Aug 2011 06:51:08 +0000 (16:51 +1000)]
Tests - eventscripts - stop timeouts waiting for backgrounded testparm
Not sleeping at all speeds up the tests. However, it can also cause
timeouts. Therefore, every time sleep is run we force the stub to do
a short 0.1s sleep instead of whatever is specified. This should be
enough to avoid races.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
59a1d54bcc15058f7b69e8596b32b26427a3ae57)
Martin Schwenke [Fri, 19 Aug 2011 03:54:49 +0000 (13:54 +1000)]
Tests - add getdebug and checktcpport to ctdb eventscripts stub
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
9c6fd7d21c99e605e20620c5c6b4e695c02af771)
Martin Schwenke [Fri, 19 Aug 2011 03:54:20 +0000 (13:54 +1000)]
Tests - add hooks to simulate ctdb commands that aren't implemented
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
e9bdfd43af3ed28a7f69a36e3fb037f252a23869)
Martin Schwenke [Fri, 19 Aug 2011 03:53:05 +0000 (13:53 +1000)]
Tests - add eventscripts testing stub for sleep command.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
aedff41ee1df0a1a573476844993fa8eda2f34bf)
Martin Schwenke [Fri, 19 Aug 2011 01:35:38 +0000 (11:35 +1000)]
Tests - Change variable used to fake listening TCP ports.
Change from $FAKE_NETSTAT_TCP_LISTEN to $FAKE_TCP_LISTEN.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
f19ba38e382034fba769145d0bfc81b2c2941563)
Martin Schwenke [Fri, 19 Aug 2011 01:24:56 +0000 (11:24 +1000)]
Tests - new NFS share checking tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
ea0db472c2ce138c723aa7e633b72ac9d8b8a6a3)
Martin Schwenke [Fri, 19 Aug 2011 01:22:51 +0000 (11:22 +1000)]
Tests - eventscripts exportfs stub should splits lines
The real exportfs splits lines longer than 15 characters. The stub
should do that too...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
fb3e123b097d9e36d281c3ab4f3e9a4799fa27bc)
Martin Schwenke [Fri, 19 Aug 2011 01:21:33 +0000 (11:21 +1000)]
Tests - add -T (trace) option to eventscripts run_test.sh
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
08eeb788523afe19760b00f40339b702eb193712)
Martin Schwenke [Tue, 30 Aug 2011 06:37:04 +0000 (16:37 +1000)]
Tools - fix "ctdb scriptstatus -Y" output
Lines in machine readable output always start with a colon (':').
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
a779d83a6213e2ba21621f7e090964428f89422d)
Martin Schwenke [Tue, 30 Aug 2011 06:31:17 +0000 (16:31 +1000)]
Eventscripts - use ctdb scriptstatus -Y when replaying status
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
5be904fb1fbd546618d25509b41ab836db62a70a)
Martin Schwenke [Mon, 16 May 2011 04:23:28 +0000 (14:23 +1000)]
Eventscripts: add a synchronous synthetic reconfigure event.
In the current code services can only be reconfigured asynchronously.
This means that configuration file changes can be made, an asychronous
reconfigure event can be triggered, and it always succeeds. Some time
later when a service is actually reconfigured then a failure may be
seen
This adds a synthetic reconfigure event that reconfigures a service
synchronously so that any failure is reported on exit.
ctdb_service_check_reconfigure() is essentially reimplemented.
If a reconfigure event is in flight and an ipreallocated or monitor
event occurs then any scheduled asynchronous reconfigure is deferred
until the next monitor cycle. This is to avoid reconfigures trampling
on each other. In this case a monitor event will also replay the
previous status to try to avoid exposing any temporary instability.
If a reconfigure event collides with another reconfigure event it will
exit with status 2, indicating that the reconfigure should be retried.
The reconfigure event is implemented using a subprocess to control the
exit from the synthetic event.
As before, if a monitor event causes a scheduled synchronous
reconfigure to occure then it will replay the previous status for the
service, given that a reconfigure can cause temporary instability.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
220578bfd3507152b29ba4c28942f9d5e8733886)
Martin Schwenke [Tue, 23 Aug 2011 06:43:53 +0000 (16:43 +1000)]
Eventscripts - call ctdb_check_args() in 00.ctdb
This is the first eventscript. Sanity check as early as possible and
everyone benefits.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
0564717fcc1e21688ae5dacbd437fd493bcb8853)
Martin Schwenke [Tue, 23 Aug 2011 06:36:19 +0000 (16:36 +1000)]
Eventscripts - call ctdb_check_args() instead of doing hand checking
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
cc5bc1948dcbe8b8b25185260927b94a4b529174)
Martin Schwenke [Tue, 23 Aug 2011 06:32:34 +0000 (16:32 +1000)]
Eventscripts - new function ctdb_check_args()
Pass this "$@" to do common eventscript argument checking.
For regular use putting this in 00.ctdb would be enough. However, for
developer testing it can be useful to call this in other eventscripts.
For example, 10.interfaces and 13.per_ip_routing currently check these
by hand.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
36de7e7fd6dfeed61ef9977b8d5b568f90a9707b)
Martin Schwenke [Fri, 19 Aug 2011 04:20:58 +0000 (14:20 +1000)]
Eventscripts - ctdb_check_tcp_ports() bug fix.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
e8d9c0b251c84d6fdf6ea7d972e5f7d1d0222f9b)
Martin Schwenke [Fri, 19 Aug 2011 03:55:55 +0000 (13:55 +1000)]
Eventscripts - fix debugging buglet in ctdb_check_tcp_ports_ctdb()
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
61000e38d6016e58f67e292393756d0bd5262ae5)
Martin Schwenke [Mon, 8 Aug 2011 03:13:59 +0000 (13:13 +1000)]
Eventscripts: New configuration variable CTDB_SERVICE_AUTOSTARTSTOP.
Some of the current auto-start/stop logic is broken, particularly for
Samba. Fixing it is non-trivial.
If $CTDB_SERVICE_AUTOSTARTSTOP is "yes" then auto-start/stop services
when told to newly manage or no longer manage them. This defaults to
"yes".
However, if using a canned configuration file that doesn't set
$CTDB_SERVICE_AUTOSTARTSTOP then this stops the auto-start-stop logic
from working. Therefore, this works around CQ S1026685 - on the
system in question another daemon controls service auto-start/stop and
CTDB just gets in the way.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
ef71b8290ae49117d7bcc7166598b77cb64cc8a0)
Martin Schwenke [Wed, 17 Aug 2011 07:42:07 +0000 (17:42 +1000)]
Eventscripts - in 60.nfs uniquify the share check directory list
There are sites that have multiple entries for the same export. This
optimises the share check in this case.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
1ccdae79b64b236fc27f4653606429d73c9c3595)
Ronnie Sahlberg [Thu, 25 Aug 2011 23:39:25 +0000 (09:39 +1000)]
Logging: when we log stdout/stderr messages from eventscripts to the system log, prefix every line of output with the name of the eventscript.
CQ S1028412
(This used to be ctdb commit
392363c04185f47a826fc6ed95038342be2150bf)
Ronnie Sahlberg [Tue, 23 Aug 2011 06:35:08 +0000 (16:35 +1000)]
LibCTDB : update the ctdb tool to use libctdb to read the recovery mode
(This used to be ctdb commit
750a31cf95c356a0ee071967537eb615dce35845)
Ronnie Sahlberg [Tue, 23 Aug 2011 06:32:38 +0000 (16:32 +1000)]
LibCTDB : uptade the ctdb tool to use libctdb to query for the recmaster
(This used to be ctdb commit
81c14c8625a6d5670b8795a655d7a3f3318009e5)
Ronnie Sahlberg [Tue, 23 Aug 2011 06:15:34 +0000 (16:15 +1000)]
LibCTDB : initialize ctdb->pnn to -1 when we create a new context
but before we learn the pnn of the local node
(This used to be ctdb commit
2cc48be3219b887b85649a14db311af0549041cf)
Ronnie Sahlberg [Tue, 23 Aug 2011 05:13:40 +0000 (15:13 +1000)]
LibCTDB : change the ctdb_fetch_lock_once test tool to use libctdb instead of the old client
(This used to be ctdb commit
cd1080726d7787b335ab4bfb64a7991237ab92f5)
Ronnie Sahlberg [Tue, 23 Aug 2011 05:00:27 +0000 (15:00 +1000)]
LibCTDB : add support for getrecmode
(This used to be ctdb commit
b663f286ea8edd64c0405a1ab45b6ef1da501bf5)
Ronnie Sahlberg [Tue, 23 Aug 2011 02:43:16 +0000 (12:43 +1000)]
LibCTDB: add commands where an application can query how many commands are active
and we have not yet received a reply to.
Applications may use this command to query if it is "safe" to stop the event system and sleep
or whether it should first wait for all activity to ctdb daemons to cease first.
(This used to be ctdb commit
8d89bfdfd1f55dfeb22890b8bb0f08f31d1fa91a)
Volker Lendecke [Mon, 22 Aug 2011 14:40:58 +0000 (16:40 +0200)]
Fix a const warning
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
e25559087c9752502580875f7e33f3c416c05f84)
Volker Lendecke [Mon, 22 Aug 2011 14:39:32 +0000 (16:39 +0200)]
Remove an unused variable
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
04c3d9c7c9ffa8bb95b0bf1513fd79f6c1096a2f)
Volker Lendecke [Fri, 19 Aug 2011 15:05:36 +0000 (17:05 +0200)]
libctdb: "unpack_reply_control" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
bb8f68f0256c43fe0671fe45023d1c88e340ad96)
Volker Lendecke [Fri, 19 Aug 2011 15:05:36 +0000 (17:05 +0200)]
libctdb: "unpack_reply_call" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
77ae553249ef1e1d467d792ac033f2aaa4e337e6)
Volker Lendecke [Fri, 19 Aug 2011 15:05:36 +0000 (17:05 +0200)]
libctdb: "ctdb_request_free" does not need the ctdb_connection parameter
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
5a5ed2a43b76bec69494b6cdc6451527f5c472e5)
Volker Lendecke [Fri, 19 Aug 2011 14:36:20 +0000 (16:36 +0200)]
libctdb: Make sure ctdb_request->ctdb is filled correctly
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
06433d20a43d41f05b96a9dda6dc5931539feaa3)
Volker Lendecke [Thu, 18 Aug 2011 12:47:09 +0000 (14:47 +0200)]
libctdb: Ensure 0-termination of sun_path
Rusty, please check!
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
955f67a02026b157440d2ae87ead193773331e75)
Volker Lendecke [Thu, 18 Aug 2011 11:59:48 +0000 (13:59 +0200)]
libctdb: Fix a few format warnings
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
fa6564c24429e084be728dbe6eea1dec13e58709)
Volker Lendecke [Thu, 18 Aug 2011 11:57:58 +0000 (13:57 +0200)]
libctdb: Add license header to messages.c
Rusty, please check!
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
4bceba374be82e76ba5d9d923172e85e9365b990)
Volker Lendecke [Thu, 18 Aug 2011 11:37:23 +0000 (13:37 +0200)]
libctdb: Reorder attachdb
No code change, this is for easier reading the sequence of what happens
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
883b9b185dce03a6bf233fbf2cfabad9883519e5)
Volker Lendecke [Thu, 18 Aug 2011 11:55:24 +0000 (13:55 +0200)]
libctdb: Reorder set_message_handler
No code change, this is for better readability
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
e0f93459e05eef33024096654b4aaf1eb3c6d7c4)
Volker Lendecke [Thu, 18 Aug 2011 11:54:36 +0000 (13:54 +0200)]
libctdb: Correct
4bfdfda, stddef.h is needed by libctdb_private.h
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
683caa7bbf45d5b6791e53e2f3ee6d0ac3b08f28)
Volker Lendecke [Wed, 17 Aug 2011 12:46:43 +0000 (14:46 +0200)]
Add missing #include to libctdb/ctdb.c
We need that to have the "offsetof" macro, thus we don't need to redeclare it
in libctdb_private.h
Signed-off-by: Michael Adam <obnox@samba.org>
(This used to be ctdb commit
4bfdfdae4f8ab23f14bc6ab4c06b66c07714ec17)
Ronnie Sahlberg [Wed, 17 Aug 2011 04:10:04 +0000 (14:10 +1000)]
Merge remote branch 'martins/eventscripts'
(This used to be ctdb commit
bb008c01989ebb173a3f095ebd2f90ab54f9da91)
Martin Schwenke [Wed, 17 Aug 2011 04:02:45 +0000 (14:02 +1000)]
Eventscripts - new default TCP port checker using "ctdb checktcpport"
New function ctdb_check_tcp_ports_ctdb(). This should be fast... and
is now the default checker. If it fails in an unexpected way we fall
back to the nmap and netstat checkers.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
a1e16a707ce204817531a61455000361f972080a)
Martin Schwenke [Wed, 17 Aug 2011 02:12:20 +0000 (12:12 +1000)]
Eventscripts - generalise TCP port checking plus new nmap-based checker
Split the netstat-specific parts of ctdb_check_tcp_ports() into new
function ctdb_check_tcp_ports_netstat().
Implement new ctdb_check_tcp_ports_nmap() function that uses
"nmap -PS" to check if the desired ports are listening.
ctdb_check_ctdb_ports() now uses new configuration variable
CTDB_TCP_PORT_CHECKERS to decide which port checkers to try. Default
value is currently "nmap netstat". If nmap is not found then this
will fall back to netstat - if logging is at debug level this will
also fill the logs with message saying the nmap checker failed. This
indicates that either nmap should be installed or the default value of
CTDB_TCP_PORT_CHECKERS should be changed (in a configuration file) to
avoid trying to use nmap.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
d9651175b40b9454e7d4e98291955fcf1445085e)
Martin Schwenke [Wed, 17 Aug 2011 00:27:01 +0000 (10:27 +1000)]
Eventscripts - ctdb_check_tcp_ports() only prints netstat output if debugging
Use the new debug function to conditionally print the netstat output.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
44c14aeeb11080980fe07c7396d06843a4870747)
Martin Schwenke [Fri, 5 Aug 2011 06:39:57 +0000 (16:39 +1000)]
Eventscripts - weaken TCP port check message if CTDB has just been started.
Sometimes smbd and other services can take a while to start,
especially when there is a lot of activity after ctdbd has just
started. The TCP port check can then pollute the logs with lots of
"ERROR" messages and possibly extra debug.
This creates a flag file when a service is started (but not restarted)
and this flag is removed the first time that TCP port checks succeed
for that service. When a port check fails and the flag file still
exists, a less extreme "INFO" message is printed rather than the usual
"ERROR" message. This means that until the node actually becomes
healthy we see more friendly messages.
The subtext is that we're hearing false positive reports "recreates"
of CQ S1024874 (samba stopped responding on port 445) quite often when
ctdbd is started. This reduces the chances of people reporting such
false recreates...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
571865eb6ef847857129d0b1e2ba5fa7254bfe8c)
Martin Schwenke [Tue, 5 Jul 2011 01:32:06 +0000 (11:32 +1000)]
Eventscript functions: optimise ctdb_check_tcp_ports() and add debug.
ctdb_check_tcp_ports() runs "netstat -a -t -n" in a loop for each
port. There are 2 problems with this:
* Netstat is run on each loop iteration when it need only be run once.
* The -a option is used to list all connections but the function only
cares about the listening ports. There may be many thousands of
non-listening ports to grep through.
This changes ctdb_check_tcp_ports() to run netstat with the -l option
instead of the -a option. It also only runs netstat once before the
main loop.
When a port is found to not be listening the output of the netstat
command is now dumped to help with debugging.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
830355a8b18c53cfcc3ad1e3009bbb1a7a681fa0)
Martin Schwenke [Tue, 16 Aug 2011 23:44:11 +0000 (09:44 +1000)]
Eventscripts: add a debug() function and call ctdb_set_current_debuglevel()
The debug function passes its arguments to echo if
$CTDB_CURRENT_DEBUGLEVEL is >= 4 (i.e. DEBUG). If no args are given
then use stdin - this allows the function to be used with here
documents.
To ensure $CTDB_CURRENT_DEBUGLEVEL is set,
ctdb_set_current_debuglevel() is called near the end of the functions
file.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
6143483d9f87322578c00f12081e381f425226ca)
Ronnie Sahlberg [Wed, 17 Aug 2011 00:16:35 +0000 (10:16 +1000)]
Add a new command 'ctdb checktcpport <port>'
that tries to bind to the specified port on INADDR_ANY.
This can be used for testing if a service is listening to that port or not.
Errors are printed to stdout and the returned status code is either 0 : if we managed to bind to the port (in which case the service is NOT listening on that bort) or the value of errno that stopped us from binding to a port.
errno for EADDRINUSE is 98 so a script using this command should check the status code against the value 98.
If this command returns 98 it means the service is listening to the specified port.
(This used to be ctdb commit
04cbb490c5a075080923fde58af7082572c55c43)
Ronnie Sahlberg [Tue, 16 Aug 2011 23:59:42 +0000 (09:59 +1000)]
dont use a too big persistence timeout value
(This used to be ctdb commit
82628e32c431d66b806399ffb9657c3a031f6428)
Martin Schwenke [Tue, 16 Aug 2011 23:14:23 +0000 (09:14 +1000)]
Eventscripts - conditionally inherit ctdbd debug level in each monitor event
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
a7eebc06f81a7b0a3fba93759bcbdeabc8c2e86e)
Martin Schwenke [Tue, 16 Aug 2011 23:00:46 +0000 (09:00 +1000)]
Eventscripts - new function ctdb_set_current_debuglevel()
This function ensures that CTDB_CURRENT_DEBUGLEVEL is set. It works
like this:
1. If it is already set then do nothing, since it might have been set
some other way.
The recommended "other way" would be to add a file in rc.local.d/.
2. If it is not set then set it by sourcing
/var/ctdb/eventscript_debuglevel.
3. If this file does not exist then create it using output from "ctdb
getdebug".
If the optional 1st argument is set to "create" then don't source an
existing file but create a new one instead - this is useful for
creating the file just once in each event run in, say, 00.ctdb.
If there's a problem getting the debug level from ctdb then it is
silently set to 0 - no use spamming logs if our debug code is
broken...
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
93910921c8a25f2b029733cd938069ff7c7bdab7)
Martin Schwenke [Tue, 16 Aug 2011 03:28:40 +0000 (13:28 +1000)]
Eventscripts - ensure the statd update-trigger file always exists.
See the comment in the code for details.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
8ee9856996a8ec738e9d3ea7f1561605da526b8c)
Martin Schwenke [Tue, 16 Aug 2011 03:18:40 +0000 (13:18 +1000)]
Eventscripts: remove "return 0" from 50.samba service_stop().
This potentially masks errors and was basically included by accident.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
e7e4a1b4f31118027fd13a6223192f9957cf2e74)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:53:04 +0000 (15:53 +1000)]
Change the errors for 10.interface to clearly state ERROR: for error messages
Update the tests system to catch the new error strings generated by this change
(This used to be ctdb commit
a2c30d88348da47d1a733a16e4c7d83c3becb6df)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:43:15 +0000 (15:43 +1000)]
Merge remote branch 'martins/eventscript_tests'
(This used to be ctdb commit
4e670d9bc1bdeb2abd7e846bc36e02f0aa0d7309)
Martin Schwenke [Mon, 15 Aug 2011 05:40:35 +0000 (15:40 +1000)]
Tests - exportfs stub needs to print out export options.
This is needed due to
bd39b91ad12fd05271a7fced0e6f9d8c4eba92e6.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
92f8e31f6995836b1668639a4dac2862efee269a)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:27:50 +0000 (15:27 +1000)]
Merge remote branch 'martins/eventscript.10.interface'
(This used to be ctdb commit
0d17daab38d4086f922a8006d4c545133adca191)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:22:20 +0000 (15:22 +1000)]
Merge remote branch 'martins/60_nfs_regression'
(This used to be ctdb commit
845fb0ba24cf9118470c58fae7103ab8322ce079)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:20:18 +0000 (15:20 +1000)]
Merge remote branch 'martins/eventscript.60.nfs.rpc'
(This used to be ctdb commit
2e30a2bb4371a846c7a768affa15883211642d5c)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:16:06 +0000 (15:16 +1000)]
Merge remote branch 'martins/test_suite'
(This used to be ctdb commit
f9899b1b96056d23628356589c855cf2262e5152)
Ronnie Sahlberg [Mon, 15 Aug 2011 05:15:12 +0000 (15:15 +1000)]
Merge remote branch 'martins/eventscript_tests'
(This used to be ctdb commit
06b322ad6eff8d4e691f8e014b7d85983b261147)
Martin Schwenke [Mon, 15 Aug 2011 03:53:39 +0000 (13:53 +1000)]
Tests - ctdb listvars test should allow alphanumericals in tunable names.
This matches the new "LCP2PublicIPs" tunable.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
0680437bf5f02aeaed6387370e58bbdba2c04f28)
Ronnie Sahlberg [Mon, 15 Aug 2011 00:23:50 +0000 (10:23 +1000)]
Change the default for ip failover to be LCP2 and not DeterministicIPs
(This used to be ctdb commit
038916248a73d6a250108c9235c0c4f76dba8e0c)
Martin Schwenke [Tue, 5 Jul 2011 07:21:57 +0000 (17:21 +1000)]
Eventscripts: 10.interfaces - make startup event actually mark interfaces up!
The startup event intends to mark interfaces up. However, it doesn't
actually do that because $INTERFACES is empty.
This uses the function get_all_interfaces() to list the
interfaces... and then mark them up.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
fc62bf0975c6059ee467285565d0dc3b4daaf238)
Martin Schwenke [Tue, 5 Jul 2011 07:20:09 +0000 (17:20 +1000)]
Eventscripts: 10.interfaces - startup comment says assume all interfaces good.
Interfaces are currently marked down. Mark them up instead, as per
the comment... and discussion with Ronnie.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
35942841229cc72ce363a7236aec708f1a33136b)
Martin Schwenke [Tue, 5 Jul 2011 07:18:30 +0000 (17:18 +1000)]
Eventscripts: 10.interfaces - new function get_all_interfaces().
Move existing interface listing code to new function in preparation
for using it in startup event.
While we're here change the "sort | uniq" into "sort -u" and save some
complexity.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
cd1442531ad079b11c60f46ee9d34f5104bef219)
Martin Schwenke [Tue, 28 Jun 2011 07:07:39 +0000 (17:07 +1000)]
Eventscripts: 10.interface clean-ups - minor tweaks and new comments.
* sed can read files, it doesn't need a file piped to it
* use $() subshells instead of `` - they seem to quote better in dash
* tweak the uniquifying code so that it is easier to read
* add comments
* remove some extraneous semicolons at ends of lines
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
5f49537889a92c3cb68d9203912188bedf00ecd4)
Martin Schwenke [Fri, 12 Aug 2011 06:30:54 +0000 (16:30 +1000)]
Tests: re-enable the NFS eventscript tests - they work again.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
3e145ab1bb61ed2087ec5ce6183ee24802686ed3)
Martin Schwenke [Fri, 12 Aug 2011 06:28:09 +0000 (16:28 +1000)]
Eventscripts: In 60.nfs don't restart NFS when restarting rpc.lockd.
This effectively reverts
953dbfbddad656a64e30a6aca115cb1479d11573 and
is a policy decision.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit
380c9263eb37db5a250264316e250c2160908263)