summaryrefslogtreecommitdiff
path: root/ctdb/tools
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* ctdb-tools: Have onnode pass -n option even when regular ssh not in useMartin Schwenke2018-10-081-6/+3
| | | | | | | | ONNODE_SSH is really a test hook, so it doesn't need to support completely random values. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Add fd argument to ctdb_connection_list_read()Amitay Isaacs2018-07-282-4/+4
| | | | | | | | | This makes testing easier. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Avoid use of non-portable getopt in onnodeMartin Schwenke2018-07-281-31/+22
| | | | | | | | | | getopt is being used with non-portable options. Use simpler, POSIX-compliant getopts instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Improve portability by not using /bin/bash directlyMartin Schwenke2018-07-281-1/+1
| | | | | | | | | | | | | FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash" for better flexibility. There are still many integration tests that use /bin/bash but this at least lets FreeBSD start running tests. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Switch to using ctdb_sock_addr_mask_from_string()Martin Schwenke2018-07-271-1/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: All ctdb event commands to run without ctdbdMartin Schwenke2018-07-111-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Remove old event daemon toolAmitay Isaacs2018-07-051-536/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Switch to using new event daemon toolAmitay Isaacs2018-07-051-34/+7
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb: Fix build on AIXAmitay Isaacs2018-07-021-3/+3
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Move capture_socket functions to ctdb_socket.[ch]Martin Schwenke2018-07-022-2/+0
| | | | | | | | | | | | | | The system_<os>.c files contain a lot of duplication, making maintenance difficult. These functions are being merged into system_socket.c and system.c. Bring across ctdb_sys_open_capture_socket(), ctdb_sys_close_capture_socket() and ctdb_sys_read_tcp_packet(). Remove empty system_<os>.c files. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Move ctdb_sys_send_tcp() to ctdb_socket.[ch]Martin Schwenke2018-07-021-0/+1
| | | | | | | | | | | | | | | | The system_<os>.c files contain a lot of duplication, making maintenance difficult. These functions are being merged into system_socket.c and system.c. Bring across tcp_checksum(), renamed to ip_checksum(). uint16_checksum() becomes static. Use the BSD struct tcphdr field names for portability. See the comment in the code for more details about how we get this to compile on older glibc versions. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Rename system utility filesMartin Schwenke2018-07-021-0/+1
| | | | | | | | | system_socket.[ch] will contain all the raw socket code and other functions that use ctdb_sock_addr. system.[ch] will contain other platform dependent functions. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Use load_script_options() in miscellaneous scriptsMartin Schwenke2018-05-122-2/+2
| | | | | | | | | | | | Some of these just aim to load the generic script.options file while others target more specific files. For NFS configuration, always use 60.nfs.options - even for 06.nfs. This could be carefully documented but will change a lot before release so there is no need. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Don't load CTDB configuration in onnodeMartin Schwenke2018-05-121-4/+0
| | | | | | | | | | onnode does not use any configuration options. Drop sourcing of functions file since the only function used was loadconfig(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Avoid filtering stderr when onnode not running in parallelMartin Schwenke2018-04-271-6/+1
| | | | | | | | | | | | | | | | stderr_filter() only does anything useful when running in parallel (i.e. with the -p option). So, simplify the non-parallel case by not using stderr_filter(). As a side-effect, this fixes an issue introduced in commit 85a4375788d8ef8345ec390807f18299abdadb20 where local daemon tests would hang when trying to start daemons with VALGRIND set (to a valgrind command that does not use --log-file). This is because valgrind would keep stderr open for its output so the pipeline involving stderr_filter() would never complete. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Avoid shellcheck SC1117: Backslash is literal in "..."Martin Schwenke2018-04-271-1/+1
| | | | | | | | | | This warning (apparently new in shellcheck 0.4.7) only applies to double-quoted strings. Change affected constant strings to use single-quotes. In the one example that contains a variable expansion escape the backslash as recommended. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Fix some -Werror=strict-overflow issuesMartin Schwenke2018-04-271-1/+2
| | | | | | | | All quite obvious. For the LCP2 one, we're not actually counting so use a bool instead of an int. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Split CTDB configuration loadingMartin Schwenke2018-03-283-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | loadconfig() currently tries to load the CTDB configuration and also any system configuration relevant to the current (event) script. Instead add a new function load_system_config() to load the distribution-specific system configuration for a component. Call this directly in the rare scripts that need the system configuration. Also call load_system_config when loading the CTDB configuration to pull in anything from the CTDB system configuration. This is partly for backward compatibility but also to get options that can be used anywhere. loadconfig() no longer takes an argument. It simply loads the CTDB configuration. Drop support for falling back to /etc/ctdb/sysconfig/ctdb (or similar). Surely there's nobody who uses that! Also, drop the indirection where loadconfig() calls _loadconfig(). This was used years ago as a test hook and is no longer required. Inexplicably, this change introduces a new shellcheck test failure, so silence this. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: No longer honour CTDB_NODES environment variableMartin Schwenke2018-03-191-10/+7
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Drop CTDB_NODES configuration optionMartin Schwenke2018-03-191-2/+0
| | | | | | | Tests now deviate from the compile-time default by setting CTDB_BASE. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop testing hook from ctdb toolMartin Schwenke2018-03-191-10/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop onnode CTDB_NODES_FILE environment variableMartin Schwenke2018-03-191-4/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop ctdb --socket optionMartin Schwenke2018-03-191-8/+4
| | | | | | | Use environment variables for test-only options. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Move handling of CTDB_SOCKET to process_command()Martin Schwenke2018-03-191-6/+6
| | | | | | | | options.socket will go away in future. This moves processing of CTDB_SOCKET close to where it is used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop a couple of unnecessary exports of CTDB_SOCKETMartin Schwenke2018-03-192-4/+0
| | | | | | | | These were necessary because CTDB_SOCKET was not already exported via test setup. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Fix documentation for ctdb ping commandAmitay Isaacs2018-03-091-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Event script commands cannot be run without daemonAmitay Isaacs2018-03-091-2/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Drop ipiface command from ctdb toolAmitay Isaacs2018-03-091-30/+0
| | | | | | | | This command is not used anywhere and also does not work for IPv6 addresses. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Wait for ctdb daemon to go away in shutdownAmitay Isaacs2018-03-091-0/+18
| | | | | | | | This can only be done on the local node. For remote node, exit as soon as the control returns. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Reindent parts of onnodeMartin Schwenke2018-03-011-75/+75
| | | | | | | | No functional changes. Best viewed with diff/show -w to avoid whitespace differences. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Remove test hooks from onnodeMartin Schwenke2018-03-011-14/+0
| | | | | | | | | | | CTDB_NODES_SOCKETS is no longer used. The test code uses ONNODE_SSH to run a fake ssh client. Leave indenting sloppy and fix it in the next commit so that this change is clear. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Revisit stray file descriptor avoidance in onnodeMartin Schwenke2018-03-011-3/+3
| | | | | | | | | | | Commit 635da189dccef6516d490c228407b9987986c578 fixed a problem where a stray file descriptor leaked into a subshell. Explicitly close the file descriptor at the outermost possible point rather than relying on fakessh() to do it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Introduce a variable to hold the ssh commandMartin Schwenke2018-03-011-2/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Change onnode to use ONNODE_SSH and ONNODE_SSH_OPTSMartin Schwenke2018-03-011-8/+8
| | | | | | | | | Instead of more generic SSH and EXTRA_SSH_OPTS. Quietly drop reference to rsh in case it gives anyone ideas. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: Drop duplicate output from dbstatisticsAmitay Isaacs2017-10-231-1/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-protocol: Add req_tunnel counts to ctdb statisticsAmitay Isaacs2017-10-101-0/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tools: Replace parse_ip() -> ctdb_sock_addr_from_string()Martin Schwenke2017-10-051-7/+17
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>