summaryrefslogtreecommitdiff
path: root/ctdb/tools
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tool: Correctly print timed out event scripts outputAmitay Isaacs2015-08-181-0/+8
| | | | | | | | | | | | | | | | | | | | | The timed out error is ignored for certain events (start_recovery, recoverd, takeip, releaseip). If these events time out, then the debug hung script outputs the following: 3 scripts were executed last releaseip cycle 00.ctdb Status:OK Duration:4.381 Thu Jul 16 23:45:24 2015 01.reclock Status:OK Duration:13.422 Thu Jul 16 23:45:28 2015 10.external Status:DISABLED 10.interface Status:OK Duration:-1437083142.208 Thu Jul 16 23:45:42 2015 The endtime for timed out scripts is not set. Since the status is not returned as -ETIME for some events, ctdb scriptstatus prints -ve duration. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11431 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 71b89b2b7a9768de437347e6678370b2682da892)
* ctdb-tools: Avoiding printing "(null)" on "ctdb eventscript" errorMartin Schwenke2015-07-141-1/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Accept hex format for pdelete and ptrans commandsChristof Schmitt2015-07-081-4/+7
| | | | | Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb: Create helper function for optional hex inputChristof Schmitt2015-07-081-39/+32
| | | | | Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb: Accept the key in hex format for the pstore commandChristof Schmitt2015-07-061-2/+11
| | | | | | | | | | | This follows the same pattern as the tstore command, and it allows specifying key strings with a trailing \0 character. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jul 6 23:23:22 CEST 2015 on sn-devel-104
* ctdb: Fix the O3 developer buildVolker Lendecke2015-04-211-10/+10
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb: Coverity fix for CID 1125625Rajesh Joseph2015-04-171-1/+10
| | | | | | | | Memory allocated by ctdb_sys_find_ifname is not freed by the caller. Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools: Drop the recovery from "reloadnodes"Martin Schwenke2015-04-071-3/+0
| | | | | | | | | | A recovery is not required: when deleting a node it should already be disconnected and when adding a node it will also be disconnected. The new sanity checks in "reloadnodes" ensure that these assumptions are met. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tool: Update "reloadnodes" to disable recoveriesMartin Schwenke2015-04-071-0/+13
| | | | | | | | If a recovery occurs when some nodes have reloaded and others haven't then the nodemaps with be inconsistent so bad things will happen. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix spurious messages about deleted nodes being disconnectedMartin Schwenke2015-04-071-5/+12
| | | | | | | | | The code was too "clever". The 4 different cases should be separate. The "node remains deleted" case doesn't need the IP address comparison (always 0.0.0.0) or the disconnected check. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Use a broadcast to connected nodes for "reloadnodes"Martin Schwenke2015-03-231-21/+19
| | | | | | | | | | | | | There is no reason to serialise these or even handle remote nodes first. Using a broadcast is more efficient and is less code. Update expected test results to reflect changed order of messages. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Mar 23 15:04:00 CET 2015 on sn-devel-104
* ctdb-tools: Sanity check changes before processing "reloadnodes"Martin Schwenke2015-03-231-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "ctdb reloadnodes" currently does no sanity checking of the nodes file. This can cause chaos if a line is deleted from the nodes file rather than commented out. It also repeatedly produces a spurious warning for each deleted node, even if the node was deleted a long time ago. Instead compare the nodemap with the contents of the local nodes file to sanity check before attempting any reloads. Note that this is still imperfect if the nodes files are inconsistent across nodes but it is better. Also ensure that any nodes that are to be deleted are already disconnected. Avoid trying to talk to deleted nodes. The current implementation is a bit unfortunate when it comes to deleting nodes. The most obvious alternative to the above complexity would be to reloadnodes on the specified node first, then fetch the node map (in which newly deleted nodes would be marked as such) and then handle the remote nodes. However, the implementation of reloadnodes is asynchronous and it only actions the reload after 1 second. This is presumably to avoid the recovery master noticing the inconsistency between nodemaps and triggering a recovery before all nodes have had their nodemaps updated. Note that this recovery can still occur if the check is done at an inconvenient time. A better long term approach might be to quiesce the recovery master checks while reloadnodes is in progress. Update a unit test to reflect the change. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Add cross-node file comparison to "reloadnodes"Martin Schwenke2015-03-231-3/+129
| | | | | | | | | | | | | This compares the nodes file on the current node with that on all nodes. If any are different then do not reload nodes. If any nodes files can't be fetched then do not reload nodes. This could be because some nodes are running an older version without this feature. This is unsupported: why make a major cluster reconfiguration while a cluster is half upgraded? Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: "reloadnodes" should only run against current nodeMartin Schwenke2015-03-231-9/+15
| | | | | | | | | It should not be possible to specify "-n <othernode>", unless <othernode> is the current node. To support this, add new function assert_current_node_only(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Remove unused struct pnn_node and function read_pnn_node_file()Martin Schwenke2015-03-231-51/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Reimplement read_natgw_nodes_file() using ctdb_read_nodes_file()Martin Schwenke2015-03-231-17/+16
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Reimplement read_nodes_file() using ctdb_get_nodes_file()Martin Schwenke2015-03-231-19/+24
| | | | | | | | Update the implementation of "ctdb xpnn" and "ctdb listnodes" accordingly. Update associated tests too. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop a debug message to DEBUG levelMartin Schwenke2015-03-161-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tool: Print a warning when setting an obsolete tunable variableMartin Schwenke2015-02-181-0/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Bracket IP addresses in onnode (for IPv6)Martin Schwenke2014-12-051-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tool: Fix "ctdb -Y ifaces" output to have trailing delimitersMartin Schwenke2014-12-051-1/+1
| | | | | | | In the CTDB CLI tool source code and the documentation example. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Update onnode and ctdb-diagnostics to use ctdb -XMartin Schwenke2014-12-052-4/+4
| | | | | | | Also update onnode unit tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Add -X option for machine parsable output with separator '|'Martin Schwenke2014-12-051-0/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Add -x option to specify delimiter for machine readable outputMartin Schwenke2014-12-051-3/+29
| | | | | | | | | To support this, update printm() to replace ':' in format string with options.machineseparator, which is a string but must contain a single character. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Produce machine readable output with new function printm()Martin Schwenke2014-12-051-86/+102
| | | | | | | | | printm() is a printf(3) replacement and must be used to printing any machine readable output. It currently just calls vprintf(3). Later it will change the field delimiter. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-vacuum: Track time for vacuuming in database statisticsAmitay Isaacs2014-12-051-0/+8
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb: Rename CTDB_VERSION to CTDB_PROTOCOLAmitay Isaacs2014-10-281-2/+2
| | | | | | | CTDB_VERSION really is the ctdb protocol version. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-logging: Rework debug level parsingMartin Schwenke2014-10-281-22/+12
| | | | | | | | | | | | | Put declarations into ctdb_logging.h, factor out some common code, clean up #includes. Remove the check so see if the 1st character of the debug level is '-'. This is wrong, since it is trying to check for a negative numeric debug level (which is no longer supported) and would need to be handled in the else anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix heap-use-after-free problemAmitay Isaacs2014-10-171-2/+6
| | | | | | | | | | Found by address sanitizer. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Oct 17 12:56:02 CEST 2014 on sn-devel-104
* ctdb-logging: Remove log ringbufferMartin Schwenke2014-10-061-123/+0
| | | | | | | | | | | As far as we know, nobody uses this and it just complicates the logging subsystem. Remove all ringbuffer code and documentation. Update the local daemons startup code correspondingly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystemMartin Schwenke2014-09-102-2/+2
| | | | | | | | | | | | | | | This makes it consistent with Samba, to ease transition. Update unit test code to link to with tdb_wrap instead of including db_wrap.c. There are some potential whitespace fixes in this commit that have been ignored. CTDB's lib/tdb_wrap will be deleted after the transition to Samba's lib/tdb_wrap, so there's no point polishing it too much. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Move definition of timeval_delta() to tools/ctdb.cMartin Schwenke2014-09-101-0/+6
| | | | | | | | This function is only used in this file. Samba's lib/util doesn't have timeval_delta(), so staging a clean transition. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-util: Add extra max_size argument to file_lines_load()Martin Schwenke2014-09-101-1/+1
| | | | | | | | | This is part of a migration to Samba's lib/util. CTDB always passes 0 (i.e. no max_size) so use a simple assert() to enforce this, rather than changing a lot of code that will be discarded anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Use sys_read() and sys_write() to ensure correct signal interactionMartin Schwenke2014-08-211-15/+15
| | | | | | | ... and avoid compiler warnings in some cases. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Be more helpful when CTDB CLI tool is run on unconfigured nodeMartin Schwenke2014-08-211-0/+7
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Factor out new function find_node_xpnn() from control_xpnn()Martin Schwenke2014-08-211-5/+17
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: There is no need for forcing a recoveryAmitay Isaacs2014-07-071-13/+0
| | | | | | | | | | This effectively reverts commit 442953c540424ad0c64f4264b5ee27c45a3130e8. The correct way of telling recovery daemon to trigger a database recovery is by setting recovery mode to active. There is no need to freeze databases as recovery master will do that across the cluster anyway. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Use CTDB_ETCDIR instead of ETCDIR/ctdbAmitay Isaacs2014-06-241-1/+1
| | | | | | | This avoids hardcoding path components in source. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools-ctdb: Make natgwlist and lvsmaster more resilientMartin Schwenke2014-05-291-33/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent changes have caused these commands to attempt to get capabilities from all nodes before doing further filtering. This means that capabilities are unnecessarily fetched from nodes that are unlikely to be the master. If such a node does not answer the control then many nodes can fail to calculate the master node. In the case of natgwlist this will cause "monitor" events to fail resulting in unhealthy nodes. Restore the behaviour where capabilities are only fetched for a node that will be the master if it has the desired flags. Although this masks a problem where a connected node is not replying, it can help to avoid an outage in some cases. Add supporting tests and infrastructure. Infrastructure just lets a timeout be faked - just for ctdb_ctrl_getcapabilities_stub() so far. First test checks that this infrastructure works if the first node times out in natgwlist. Second test checks the case worked around by the above fix - that is, no failure when a node with PNN beyond the NATGW master can time out. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Thu May 29 05:59:37 CEST 2014 on sn-devel-104
* ctdb-tools-ctdb: scriptstatus should not count disabled scriptsMartin Schwenke2014-05-281-1/+7
| | | | | | | | | | | | | | | | | | script_status->num_scripts is used as the count in this message: "%d scripts were executed last %s cycle\n" However, script_status->num_scripts includes disabled scripts, which are never actually executed. Instead, count the number of scripts that aren't disabled and make the message print that. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed May 28 02:27:48 CEST 2014 on sn-devel-104
* ctdb-tools/ctdb: Unlock records before closing tdb databaseAmitay Isaacs2014-04-231-2/+2
| | | | | | | | | Now freeing ctdb_db context will close the tdb database. So make sure all the locks are released (by freeing record handles or memory context from which record handles are allocated) before freeing ctdb_db context. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools/ctdb: Detach databases only if all nodes disallow client accessAmitay Isaacs2014-04-231-0/+64
| | | | | | | | | | | This makes sure that AllowClientDBAttach is set to 0 before detaching any databases. If someone enables the tunable between checking of tunable and actual detaching of databases, then they deserve what they get. :-) Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tools-ctdb: Drop disconnected nodes when filtering by capabilityMartin Schwenke2014-04-141-3/+10
| | | | | | | | | | | | | | | | | | | | | Commit ba69742ccd822562ca2135d2466e09bf1216644b missed the point of filtering disconnected nodes while limiting the nodemap to those in the NAT gateway group. It was really to avoid trying to fetch capabilities from disconnected nodes. This should be explicitly done in filter_nodemap_by_capabilities(), otherwise "ctdb natgwlist" simply fails when there is a disconnected node. Note that the alternate solution where filter_nodemap_by_flags() is called before filter_nodemap_by_capabilities() would not be not correct. Filtering on flags first can produce a "healthier" set of nodes where none of them have the NAT gateway capability. Also extend stub for ctdb_ctrl_getcapabilities() to fail when trying to get capabilities from a disconnected node and add a corresponding test to confirm that "ctdb natgwlist" is no longer broken. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools/ctdb: Add ctdb detach command to detach databasesAmitay Isaacs2014-04-141-0/+40
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools-ctdb: Parse IP addresses when reading a list from a fileMartin Schwenke2014-03-231-21/+15
| | | | | | | | This way this logic is centralised. It also means that the IP address comparisons in the NAT gateway code are IPv6 safe. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Remove redundant filtering of trailing empty linesMartin Schwenke2014-03-231-3/+0
| | | | | | | There is a check for empty lines in the loop just below. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Use DLIST_ADD_END() to avoid reversing the listMartin Schwenke2014-03-231-14/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Factor out function read_pnn_node_file()Martin Schwenke2014-03-231-58/+36
| | | | | | | | Factor it from read_nodes_file(). Use it there and in read_natgw_nodes_file(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Read NAT gateway nodes from a separate functionMartin Schwenke2014-03-231-38/+53
| | | | | | | Now it gets easier to refactor. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools-ctdb: Add and use function filter_nodemap_by_natgw_nodes()Martin Schwenke2014-03-231-29/+43
| | | | | | | | | | | | Add another filter function, like the ones for capabilities and flags to, for filtering by NAT gateway nodes. This makes the main natgw_list function more readable. Note that this drops the early filtering of disconnected nodes, so they will now be listed in a NAT gateway group. This makes sense. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>