summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | Tests - eventscripts exportfs stub should splits linesMartin Schwenke2011-08-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | | Tests - add -T (trace) option to eventscripts run_test.shMartin Schwenke2011-08-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 08eeb788523afe19760b00f40339b702eb193712)
| * | | | Merge remote branch 'martins/eventscripts'Ronnie Sahlberg2011-09-016-47/+157
| |\ \ \ \ | | | |/ / | | |/| | | | | | | (This used to be ctdb commit 1bb814f012cb6ce436f8748b06602e8d6fae8822)
| | * | | Eventscripts - enhance ctdb_replay_monitor_status()Martin Schwenke2011-08-311-3/+31
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Eventscripts - use ctdb scriptstatus -Y when replaying statusMartin Schwenke2011-08-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 5be904fb1fbd546618d25509b41ab836db62a70a)
| | * | Eventscripts: add a synchronous synthetic reconfigure event.Martin Schwenke2011-08-301-18/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Eventscripts - call ctdb_check_args() in 00.ctdbMartin Schwenke2011-08-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Eventscripts - call ctdb_check_args() instead of doing hand checkingMartin Schwenke2011-08-302-27/+4
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit cc5bc1948dcbe8b8b25185260927b94a4b529174)
| | * | Eventscripts - new function ctdb_check_args()Martin Schwenke2011-08-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Eventscripts - ctdb_check_tcp_ports() bug fix.Martin Schwenke2011-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e8d9c0b251c84d6fdf6ea7d972e5f7d1d0222f9b)
| | * | Eventscripts - fix debugging buglet in ctdb_check_tcp_ports_ctdb()Martin Schwenke2011-08-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 61000e38d6016e58f67e292393756d0bd5262ae5)
| | * | Eventscripts: New configuration variable CTDB_SERVICE_AUTOSTARTSTOP.Martin Schwenke2011-08-302-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | Eventscripts - in 60.nfs uniquify the share check directory listMartin Schwenke2011-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | | Tools - fix "ctdb scriptstatus -Y" outputMartin Schwenke2011-08-301-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | 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)
| * | Logging: when we log stdout/stderr messages from eventscripts to the system ↵Ronnie Sahlberg2011-08-263-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | log, prefix every line of output with the name of the eventscript. CQ S1028412 (This used to be ctdb commit 392363c04185f47a826fc6ed95038342be2150bf)
| * | LibCTDB : update the ctdb tool to use libctdb to read the recovery modeRonnie Sahlberg2011-08-231-5/+3
| | | | | | | | | | | | (This used to be ctdb commit 750a31cf95c356a0ee071967537eb615dce35845)
| * | LibCTDB : uptade the ctdb tool to use libctdb to query for the recmasterRonnie Sahlberg2011-08-231-15/+8
| | | | | | | | | | | | (This used to be ctdb commit 81c14c8625a6d5670b8795a655d7a3f3318009e5)
| * | LibCTDB : initialize ctdb->pnn to -1 when we create a new contextRonnie Sahlberg2011-08-231-0/+1
| | | | | | | | | | | | | | | | | | but before we learn the pnn of the local node (This used to be ctdb commit 2cc48be3219b887b85649a14db311af0549041cf)
| * | LibCTDB : change the ctdb_fetch_lock_once test tool to use libctdb instead ↵Ronnie Sahlberg2011-08-232-33/+57
| | | | | | | | | | | | | | | | | | of the old client (This used to be ctdb commit cd1080726d7787b335ab4bfb64a7991237ab92f5)
| * | LibCTDB : add support for getrecmodeRonnie Sahlberg2011-08-233-0/+95
| | | | | | | | | | | | (This used to be ctdb commit b663f286ea8edd64c0405a1ab45b6ef1da501bf5)
| * | LibCTDB: add commands where an application can query how many commands are ↵Ronnie Sahlberg2011-08-232-0/+68
| |/ | | | | | | | | | | | | | | | | | | 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)
| * Fix a const warningVolker Lendecke2011-08-221-1/+1
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit e25559087c9752502580875f7e33f3c416c05f84)
| * Remove an unused variableVolker Lendecke2011-08-221-2/+0
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 04c3d9c7c9ffa8bb95b0bf1513fd79f6c1096a2f)
| * libctdb: "unpack_reply_control" does not need the ctdb_connection parameterVolker Lendecke2011-08-224-16/+14
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit bb8f68f0256c43fe0671fe45023d1c88e340ad96)
| * libctdb: "unpack_reply_call" does not need the ctdb_connection parameterVolker Lendecke2011-08-221-6/+5
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 77ae553249ef1e1d467d792ac033f2aaa4e337e6)
| * libctdb: "ctdb_request_free" does not need the ctdb_connection parameterVolker Lendecke2011-08-224-26/+28
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 5a5ed2a43b76bec69494b6cdc6451527f5c472e5)
| * libctdb: Make sure ctdb_request->ctdb is filled correctlyVolker Lendecke2011-08-223-7/+14
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 06433d20a43d41f05b96a9dda6dc5931539feaa3)
| * libctdb: Ensure 0-termination of sun_pathVolker Lendecke2011-08-221-1/+1
| | | | | | | | | | | | | | | | Rusty, please check! Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 955f67a02026b157440d2ae87ead193773331e75)
| * libctdb: Fix a few format warningsVolker Lendecke2011-08-221-3/+3
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit fa6564c24429e084be728dbe6eea1dec13e58709)
| * libctdb: Add license header to messages.cVolker Lendecke2011-08-221-0/+19
| | | | | | | | | | | | | | | | Rusty, please check! Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 4bceba374be82e76ba5d9d923172e85e9365b990)
| * libctdb: Reorder attachdbVolker Lendecke2011-08-221-81/+90
| | | | | | | | | | | | | | | | 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)
| * libctdb: Reorder set_message_handlerVolker Lendecke2011-08-221-28/+30
| | | | | | | | | | | | | | | | No code change, this is for better readability Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit e0f93459e05eef33024096654b4aaf1eb3c6d7c4)
| * libctdb: Correct 4bfdfda, stddef.h is needed by libctdb_private.hVolker Lendecke2011-08-222-1/+1
| | | | | | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 683caa7bbf45d5b6791e53e2f3ee6d0ac3b08f28)
| * Add missing #include to libctdb/ctdb.cVolker Lendecke2011-08-171-0/+1
| | | | | | | | | | | | | | | | | | 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)
| * Merge remote branch 'martins/eventscripts'Ronnie Sahlberg2011-08-174-12/+223
| |\ | | | | | | | | | (This used to be ctdb commit bb008c01989ebb173a3f095ebd2f90ab54f9da91)
| | * Eventscripts - new default TCP port checker using "ctdb checktcpport"Martin Schwenke2011-08-171-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts - generalise TCP port checking plus new nmap-based checkerMartin Schwenke2011-08-171-14/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts - ctdb_check_tcp_ports() only prints netstat output if debuggingMartin Schwenke2011-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts - weaken TCP port check message if CTDB has just been started.Martin Schwenke2011-08-171-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscript functions: optimise ctdb_check_tcp_ports() and add debug.Martin Schwenke2011-08-171-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts: add a debug() function and call ctdb_set_current_debuglevel()Martin Schwenke2011-08-171-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts - conditionally inherit ctdbd debug level in each monitor eventMartin Schwenke2011-08-171-0/+5
| | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a7eebc06f81a7b0a3fba93759bcbdeabc8c2e86e)
| | * Eventscripts - new function ctdb_set_current_debuglevel()Martin Schwenke2011-08-171-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * Eventscripts - ensure the statd update-trigger file always exists.Martin Schwenke2011-08-161-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | See the comment in the code for details. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 8ee9856996a8ec738e9d3ea7f1561605da526b8c)
| | * Eventscripts: remove "return 0" from 50.samba service_stop().Martin Schwenke2011-08-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | Add a new command 'ctdb checktcpport <port>'Ronnie Sahlberg2011-08-171-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | dont use a too big persistence timeout valueRonnie Sahlberg2011-08-171-2/+2
| |/ | | | | | | (This used to be ctdb commit 82628e32c431d66b806399ffb9657c3a031f6428)
| * Change the errors for 10.interface to clearly state ERROR: for error messagesRonnie Sahlberg2011-08-154-8/+8
| | | | | | | | | | | | Update the tests system to catch the new error strings generated by this change (This used to be ctdb commit a2c30d88348da47d1a733a16e4c7d83c3becb6df)
| * Merge remote branch 'martins/eventscript_tests'Ronnie Sahlberg2011-08-151-1/+1
| |\ | | | | | | | | | (This used to be ctdb commit 4e670d9bc1bdeb2abd7e846bc36e02f0aa0d7309)
| | * Tests - exportfs stub needs to print out export options.Martin Schwenke2011-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is needed due to bd39b91ad12fd05271a7fced0e6f9d8c4eba92e6. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 92f8e31f6995836b1668639a4dac2862efee269a)