summaryrefslogtreecommitdiff
path: root/ctdb/tools
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tools: Improve/add debugMartin Schwenke2022-09-201-6/+7
| | | | | | | | In particular, knowing the reason fetching the packet fails can help with debugging unsupported protocols in the pcap code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Avoid ShellCheck warning SC2295Martin Schwenke2022-07-221-2/+2
| | | | | | | | | | | | | | | | | | | For example: In /home/martins/samba/samba/ctdb/tools/onnode line 304: [ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true ^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: [ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true For more information: https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b... Who knew? Thanks ShellCheck! Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tool: Add UNKNOWN pseudo stateVinit Agnihotri2022-06-283-13/+88
| | | | | | | | | | | | | When a node is starting, CTDB reports remote nodes as unhealthy by default. This can be misleading. To hide this, report an "UNKNOWN" pseudo state when a remote node is not disconnected and the runstate is less than or equal to "FIRST_RECOVERY". Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Remove deprecated networking commands and replace with new commandsArchana2022-03-081-1/+2
| | | | | | | | | | | | | The changes are made to replace the deprecated network commands (ifconfig,netstat) with the new commands (ip addr,ss) respectively Signed-off-by: Archana Chidirala <archana.chidirala.chidirala@ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Mar 8 12:30:53 UTC 2022 on sn-devel-184
* ctdb-tools: recovery master -> leaderMartin Schwenke2022-01-171-45/+69
| | | | | | | | | | | | | | | | The following command names are changed: recmaster -> leader setrecmasterrole -> setleaderrole Command output changed for the following commands: status getcapabilities Documentation and tests are updated to reflect these changes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Use leader broadcast in get_leader()Martin Schwenke2022-01-171-9/+21
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Factor out get_leader()Martin Schwenke2022-01-171-6/+24
| | | | | | | This seems pointless but it localises a subsequent change and also starts a terminology change in the tool code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Handle leader broadcasts in ctdb toolMartin Schwenke2022-01-171-1/+32
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Print "UNKNOWN" when leader PNN is unknownMartin Schwenke2022-01-171-2/+14
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Use disable and enable controls in toolMartin Schwenke2021-09-091-45/+12
| | | | | | | | | | | | Note that there a change from broadcast to a directed control here. This is OK because the recovery master will push flags if any nodes disagree with the canonical flags fetched from a node. Static function ctdb_ctrl_modflags() is no longer used to drop it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Use hex_byte() in hex_to_data()Volker Lendecke2021-01-081-12/+5
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-tools: Drop "ctdb isnotrecmaster" commandMartin Schwenke2020-08-171-29/+0
| | | | | | | | This isn't used anywhere and can easily be checked via "ctdb pnn" and "ctdb recmaster" commands. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* lib: relicense smb_strtoul(l) under LGPLv3Ralph Boehme2020-08-031-0/+1
| | | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Aug 3 22:21:04 UTC 2020 on sn-devel-184
* ctdb: Change LVS to use leader/followerMartin Schwenke2020-07-242-9/+9
| | | | | | | | | | | Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. A couple of minor cleanups were made in the documentation (such as "LVSMASTER" -> "LVS leader"). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Change NAT gateway to use leader/followerMartin Schwenke2020-07-242-16/+16
| | | | | | | | | | Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Improve onnode's ShellCheck credibilityMartin Schwenke2020-07-161-2/+2
| | | | | | | | 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 Jul 16 06:51:47 UTC 2020 on sn-devel-184
* ctdb-tools: Allow onnode -P to respect ONNODE_SSHMartin Schwenke2020-07-161-0/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Whitespace fixupsMartin Schwenke2020-07-161-14/+14
| | | | | | | Drop some unnecessary whitespace and re-indent push(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop undocumented ONNODE_SSH_OPTS variableMartin Schwenke2020-07-161-2/+1
| | | | | | | Options can be set in ONNODE_SSH, so this variable is unnecessary. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Allow shorter runtime limit to be specifiedMartin Schwenke2020-02-101-4/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: When in test mode set process group in top-level ctdb toolMartin Schwenke2020-02-101-0/+11
| | | | | | | | | | If ctdbd hangs when shutting down in post-test clean-up then killing the process group can kill the test. When in test mode, create a process group but only in the top-level ctdb tool - the natgw and lvs helpers also run the ctdb tool. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Silence shellcheck warning SC2166Martin Schwenke2019-09-172-3/+3
| | | | | | | | | | | | | | | | This covers the following: SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. POSIX agrees that -a and -o should not be used: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html Fixing these doesn't cause much churn. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Stop deleted nodes from influencing ctdb nodestatus exit codeMartin Schwenke2019-09-171-1/+7
| | | | | | | | | | Deleted nodes should simply be ignored. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14129 RN: Stop deleted nodes from influencing ctdb nodestatus exit code Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix usage for "ctdb cattdb"Martin Schwenke2019-08-141-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop 'o' option from getopts commandMartin Schwenke2019-08-141-1/+1
| | | | | | | | | | | | Commit 90de5e0594b9180226b9a13293afe31f18576b3d remove the processing for this option but forgot to remove it from the getopts command. Versions of ShellCheck >= 0.4.7 warn on this, so it is worth fixing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14086 RN: Fix onnode test failure with ShellCheck >= 0.4.7 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: CID 1449530 - Negative loop boundMartin Schwenke2019-07-051-4/+6
| | | | | | | | | | | Regression introduced by commit 2558f96da1f9be8034f26736c8050bb38a1f82a8. count should be signed because list_of_connected_nodes() returns -1 on failure. Variable i is used in both signed and unsigned contexts, so add new signed variable j for use in signed context. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop separate parallel+verbose stdout/stderr filteringMartin Schwenke2019-07-051-31/+5
| | | | | | | | | | | | | | This has been broken for 10 years since commit 9616959bd6938e4c5c3713fe986c1e17cbdc574c, which introduced the separate filtering. This commit was missing a redirect of the output of stderr_filter() to stderr. Since nobody depends on the separate filtering (i.e. nobody reported a bug), just return to combining stdout and stderr, and filtering them together. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop no-op stdout-filter from non-parallel caseMartin Schwenke2019-07-051-1/+1
| | | | | | | | | | | | | | This filter no longer does anything useful in this context. By default it adds a pipeline with trailing cat process. In many contexts, stdout of the process being run is still open so the cat process will stay around and will stop onnode from exiting. The filters should all go away because they are simply an example of code that is trying to be too clever while causing unfortunate corner cases. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop onnode -o optionMartin Schwenke2019-07-051-6/+1
| | | | | | | I don't think anyone uses this and it causes complications. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Update all consumers of strtoul_err(), strtoull_err() to new APISwen Schillig2019-06-301-9/+21
| | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* ctdb-tools: Fix potentially uninitialised dataMartin Schwenke2019-06-051-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned conversion by declaring as size_tMartin Schwenke2019-06-051-4/+7
| | | | | | | | | | All the top-level callers pass size_t. Drop the ternary operator. The value of hsize is always positive because it is unsigned. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned comparison by declaring as intMartin Schwenke2019-06-051-1/+1
| | | | | | | | | There's no point using unsigned here. tdb_traverse() returns an int for the number of records traversed and the number of empty records can't exceed this value. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned comparison by declaring as unsignedMartin Schwenke2019-06-051-1/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned comparisons by castingMartin Schwenke2019-06-051-7/+8
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned comparisons by declaring extra variableMartin Schwenke2019-06-051-8/+9
| | | | | | | | This needs an extra variable because variable i has been used in both signed and unsigned contexts. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix signed/unsigned comparisons by declaring as unsignedMartin Schwenke2019-06-051-47/+62
| | | | | | | | | These are the simple cases where a variable (usually a loop variable) needs to be declared as an unsigned type (usually unsigned int or size_t) instead of an int. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix ctdb dumpmemory to avoid printing trailing NULMartin Schwenke2019-05-071-4/+6
| | | | | | | | | Fix ctdb rddumpmemory too. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13923 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Update error check for new string conversion wrapperSwen Schillig2019-04-111-3/+2
| | | | | | | | | | | The new string conversion wrappers detect and flag errors which occured during the string to integer conversion. Those modifications required an update of the callees error checks. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* ctdb-version: Simplify version string usageAmitay Isaacs2019-03-151-2/+2
| | | | | | | | | | | | | | | There is no need to write SAMBA_VERSION_STRING as CTDB_VERSION_STRING. Wherever required use SAMBA_VERSION_STRING directly. Avoids the confusion with two version.h files. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13789 Signed-off-by: Amitay Isaacs <amitay@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Mar 15 06:31:50 UTC 2019 on sn-devel-144
* ctdb-tools: Use wrapper for string to integer conversionSwen Schillig2019-03-011-19/+47
| | | | | | | | | | | | In order to detect an value overflow error during the string to integer conversion with strtoul/strtoull, the errno variable must be set to zero before the execution and checked after the conversion is performed. This is achieved by using the wrapper function strtoul_err and strtoull_err. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb:tools: Use correct C99 initializer for ltdb_headerAndreas Schneider2019-01-281-1/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ctdb: Use C99 initializer for poptOption in ctdb toolAndreas Schneider2019-01-281-16/+64
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ctdb: Print locks latency in machinereadable statsVolker Lendecke2019-01-161-0/+5
| | | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13742 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 16 05:34:17 CET 2019 on sn-devel-144
* ctdb-tool: Avoid data uninitialized warningsAmitay Isaacs2018-12-181-1/+4
| | | | | | | | | ../../tools/ctdb.c: In function 'str_to_data': ../../tools/ctdb.c:624: warning: 'data.dsize' may be used uninitialized in this function ../../tools/ctdb.c:624: warning: 'data.dptr' may be used uninitialized in this function Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb: Remove <file> parameter from pfetch usage infoChristof Schmitt2018-12-101-2/+2
| | | | | | | | | | | The code does not implement saving the record data to a file, so update the usage info accordingly. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Mon Dec 10 05:02:13 CET 2018 on sn-devel-144
* ctdb: Fix hex to int conversion in h2iChristof Schmitt2018-12-101-1/+1
| | | | | Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* debug: Use debuglevel_(get|set) functionAndreas Schneider2018-11-082-8/+10
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
* ctdb-tools: Detect unknown node numberMartin Schwenke2018-11-061-2/+6
| | | | | | | | | If there aren't enough addresses in the list then the shift will silently fail and the printed address will be the unshifted value of $1, which is incorrect/unexpected. So, sanity check the node number. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Use path_socket() in ctdb toolMartin Schwenke2018-11-061-2/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>