summaryrefslogtreecommitdiffstats
path: root/ctdb/tools/onnode
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-onnode: New -i option to stop stdin from being closedMartin Schwenke2013-11-271-5/+10
| | | | | | | | | | This can be useful for piping data to onnode in certain circumstances. There are now also enough command-line options that they should definitely be alphabetically ordered. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* tools/onnode: Fix healthy/ok node handlingMartin Schwenke2013-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This bit-rotted a long time ago when the "ThisNode" column was added to "ctdb -Y status" output. The fake "ctdb -Y status" output in the test was never updated to reflect this change. Instead of making sure that all columns are "0", just check that they're not "1". This implicitly ignores "Y" and "N" in this "ThisNode" column without having to do anything else clever. Also update associated tests. The main "ctdb ok" test had a duplicate opening line for a here document, which was tickled by this change. This fixes samba bz#8122. Signed-off-by: Martin Schwenke <martin@meltin.net> onnode test fixup Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 01a46205c3a3d6609dc0b0324319b89667dffa32)
* tools/onnode: Add -P option to push files to given nodesMartin Schwenke2012-07-301-13/+36
| | | | | | | | | | | | | | A list of files is given rather than a command. These files are pushed to the specified nodes. Quoting is fragile/broken so filenames with spaces won't work - you win some, you lose some. :-) All of the other onnode options should work together with this option. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit aed9b98ddbbf3e81de4f7257a10676565f7d7507)
* onnode: unset EXTRA_SSH_OPTS when using fakesshMartin Schwenke2011-10-181-0/+1
| | | | | | | | | This case was never tested and fakessh obviously won't handle the extra arguments. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 02184bd5b9ab94cdf2b9ff92e56a509f92f9e4aa)
* onnode: fix natgwlist nodespecMartin Schwenke2011-06-081-5/+21
| | | | | | | | | | | | This hasn't worked for a while if ever. We treat this case specially because the output has 2 works on the 1st line. We also handle the error case where /etc/ctdb_natgw_nodes exists but none of the other $NATGW_* configuration is done. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 66e89797c7866d207a5bbf1836f52d70dba7cea6)
* onnode: fix get_nodes_with_status()Martin Schwenke2011-06-081-8/+11
| | | | | | | | | | | | | | | | Setting IFS and looping though items with colons in them doesn't work. Change this to read through the output line by line. The header line needs to be thrown away by throwing away everything up to the 1st newline. Keep stderr from the "ctdb status" command, otherwise debugging is impossible. On error, append any output from ctdb to onnode's error message. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d60592cf99999f10344a05ef0571fb300bb9d97c)
* onnode: Remove an unnecessary comment.Martin Schwenke2011-06-081-1/+0
| | | | | | | | | The comment about $CTDB_NODES_SOCKETS is meaningless. The code ti refers to works just find with $CTDB_NODES_SOCKETS. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 74e69a564bac653dadfffe8b08145b9b3be16e61)
* onnode: Future-proof get_nodes_with_status().Martin Schwenke2011-06-081-28/+29
| | | | | | | | | | | The current code requires knowledge of the number of status bits output by "ctdb status -Y". This changes the code to be completely general. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e1788f25fde3d1f26bf4831a331741aa280f6fbc)
* onnode: Exit with error for unknown command-line flags.Martin Schwenke2011-06-081-1/+3
| | | | | | | | Use of "local" was masking errors in command-line processing. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit ca80adda7517b43147ef30156ae34c66b29fa2bd)
* onnode: Be defensive when listing IPs of nodes with designated status.Martin Schwenke2011-06-081-1/+1
| | | | | | | | | | | | | | | The current version gives the last item left after stripping the known fields. If an insufficent number of status fields is stripped then this would return a residual status field value, which turned out to be a valid IP address for localhost... so no error occurs. This change means that the node number is stripped and any residual status field value will stay appended, causing an error the first time this command is tested. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 74715e6ec7b67c6f0e863aa51c87279758d6bf91)
* onnode - Fix long standing bug in onnode healthy/ok/connected/con.Martin Schwenke2011-06-081-2/+2
| | | | | | | | | | | When the output of "ctdb status -Y" changed to add an extra status column we didn't fix onnode. This adds a match for the extra column. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 793febaebd3d484ddfbbcb47aaa0cdf3cfc1a00d)
* onnode: update algorithm for finding nodes file.Martin Schwenke2010-01-211-2/+15
| | | | | | | | | | | | | | | | | 2 changes: * If a relative nodes file is specified via -f or $CTDB_NODES_FILE but this file does not exist then try looking for the file in /etc/ctdb (or $CTDB_BASE if set). * If a nodes file is specified via -f or $CTDB_NODES_FILE but this file does not exist (even when checked as per above) then do not fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set). The old behaviour was surprising and hid errors. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 6b5a5bb62369284585057caf09f05d2d5e3b9927)
* onnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.Martin Schwenke2010-01-211-3/+5
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a9aa2e06774e8cd59a86d3343d3da2a2769561b5)
* New onnode options: -f to specify nodes file, -n to allow use of hostnames.Martin Schwenke2009-10-141-7/+16
| | | | | | | | | | | | | | The -f option allows an alternate nodes file to be specified, overriding the CTDB_NODES_FILE environment variable. The -n option allows hostnames to be used instead of node numbers. Using a range of hostnames is invalid, so hostnames can't contain hyphens ('-') - sorry! You can use this option without a nodes file by specifying "-f /dev/null". Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 46474e5f21fd97dd765c616647ff46055a9970e7)
* Revert "try to restart statd everytime it fails, not just the first time"Ronnie Sahlberg2009-09-151-2/+23
| | | | | | This reverts commit 4f7b39a4871af28df1c4545ec37db179fa47a7da. (This used to be ctdb commit db7b96304e4725f29b12398b7582e385daed63ed)
* try to restart statd everytime it fails, not just the first timeRonnie Sahlberg2009-09-151-23/+2
| | | | (This used to be ctdb commit 4f7b39a4871af28df1c4545ec37db179fa47a7da)
* onnode: add "any" nodespec to select any node with running CTDB.Martin Schwenke2009-09-081-2/+23
| | | | | | | | | | | | | | | In testing and other situations (e.g. eventscripts) it is necessary to select a node where a ctdb command can be run. The whole idea here is to avoid nodes where ctdbd is not running and where most ctdb commands would fail. This implements a standard way of doing this involving a recursive onnode command. There is still a small window for a race, where the selected node is suddenly shutdown, but this is unavoidable. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit fb47cce86c0edae5caaf485f13ae7a151b6cb00d)
* onnode: update tests for healthy and connected to cope with new stopped bit.Martin Schwenke2009-07-281-2/+2
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit bfc926c866e361ab28330747544b268ba130bf30)
* Fix minor onnode bugs relating to local daemons.Martin Schwenke2009-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a0f5148ac749758e2dfbd6099e829c5bf1d900e6 caused a subtle regression. Due to the subtlety, this description is much longer than the 1 line patch that fixes it! The regression, where a process that invokes onnode is unexpectedly blocked, is only apparent if the following conditions are met: 1. $CTDB_NODES_SOCKETS is set; 2. The command passed to onnode attempts to background a process; and 3. onnode is run in certain types of subshell (e.g. foo=$(onnode ...)). In particular, when testing against local daemons (i.e. condition (1) is met), tests/simple/07_ctdb_process_exists.sh would fail (because it does both (2), (3)). The problem is caused by the use of file descriptor 3 in the code that allows separate filtering of stdout and stderr. A backgrounded process will have this descriptor open and the $(...) construct appears to wait for all file descriptors to be closed. This only happens with local daemons because SSH is replaced by a shell and file descriptor 3 leaks into that shell. It does not occur when SSH is used because the file descriptor does not leak into the remote shell where the process is backgrounded. The fix is simply to redirect file descriptor 3 to /dev/null in the fakessh function, which is used when $CTDB_NODES_SOCKETS is set. Also fixed is another minor bug when the -o option and $CTDB_NODES_SOCKETS are used in combination. The code uses the node name as a suffix for the output filename(s). Usually this is an IP address. However, when $CTDB_NODES_SOCKETS is in use the node name is the socket name, which might be a path several directories deep. Each output file is created via a simple redirection and this would fail if unexpected directories appear in the filename. 3 possible fixes were considered: 1. Replace all '/'s in the node name by '_'s. Nice and simple. 2. Use the basename of the node name. However, sockets may be in different directories but have the same basename. 3. Create all required directories before redirecting. This is a little more complex and probably doesn't meet the user's expectations. Option (1) is implemented here. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c97d56d93d9c1007a4e85affb19ed0c2d0e11b6d)
* teach ONNODE about deleted nodesRonnie Sahlberg2009-06-021-3/+4
| | | | (This used to be ctdb commit 03d304e72a5839dc8d8d2e2312b346c21dca5774)
* Fix lvsmaster and natgwlist nodespecs.Martin Schwenke2009-05-121-1/+5
| | | | | | | | | They both need to use a -Y option to ctdb and for natgwlist we only want the 1st line. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit e781ff61e17d733349021bb036514f823c7cbfbb)
* New lvs/lvsmaster and natgw/natgwlist nodespecs for onnode.Martin Schwenke2009-05-121-37/+51
| | | | | | | | | | Some code re-factoring to implement this and to make it easy to implement new ones. New simpler implementation of echo_nth() no longer uses deleted get_nth() function. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 29559f5dd099bec210e98909c9b2e048461b7c81)
* New option "-o <prefix>" saves stdout from each node to file <prefix>.<ip>.Martin Schwenke2009-05-121-18/+36
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a0f5148ac749758e2dfbd6099e829c5bf1d900e6)
* Add some simple tests that can be run from within the tree.Martin Schwenke2008-11-201-10/+26
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit eacb2ef82ea4809d874158756db973dd1e3fc8fc)
* onnode changes. "ok" is an alias for "healthy", "con" is an alias forMartin Schwenke2008-09-121-12/+36
| | | | | | | | | | "connected". Allow "rm" or "recmaster" to be a nodespec for the recovery master. Better error handling for interaction with ctdb client. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 05bdafed82106a0d8bfa53cd730eb3e1db68a51f)
* Changes to onnode. Add "healthy" and "connected" as possibleMartin Schwenke2008-09-121-10/+59
| | | | | | | | | nodespecs. Since we're now explicitly using bash, use local variables when sensible. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 16626eaf9c63adfe780e8f51f9cd97810647e731)
* Merge commit 'origin/master' into martinsMartin Schwenke2008-09-121-3/+15
|\ | | | | | | (This used to be ctdb commit 79ad588d61a56a062c043eae6aba3370ec10ac61)
| * fixed up exit status for onnodeAndrew Tridgell2008-07-141-3/+15
| | | | | | | | (This used to be ctdb commit c26afe26cc5c1f9cd9eef74166b5fc39dde591d3)
| * When in verbose mode with -p, each line is prefixed with the nodeMartin Schwenke2008-07-101-23/+20
| | | | | | | | | | | | | | | | | | | | | | address/name. To implement this stderr has redirected to stdout - this doesn't need to be done but is the simplest implementation. Remove -t option since it doesn't seem to accomplish much but causes spurious messages to be displayed by ssh. Add explicit -h and --help options. Make style of usage message consistent with documentation. Document new features in doc/onnode.1.xml. (This used to be ctdb commit dfaf2c1581e547df831b3171ad47acd27b4ca2af)
| * Complete rewrite of tools/onnode. Remove old tools/onnode.ssh,Martin Schwenke2008-07-101-0/+194
| | | | | | tools/onnode.rsh. (This used to be ctdb commit 2cc9aba3d7e608eccc29c897f710b69f30653bbf)
* Signed-off-by: Martin Schwenke <martin@meltin.net>Martin Schwenke2008-07-111-1/+1
| | | | | | Minor fix to tools/onnode usage message. (This used to be ctdb commit 81dd4155e92fc9d11ac788a97a5fd3c50488cc80)
* Signed-off-by: Martin Schwenke <martin@meltin.net>Martin Schwenke2008-07-111-1/+1
| | | | | | In tools/onnode, remove reference to -t option in usage message. (This used to be ctdb commit f2e6b7e9d130eba9132eddda1a5e244a542a23ed)
* When in verbose mode with -p, each line is prefixed with the nodeMartin Schwenke2008-07-101-23/+20
| | | | | | | | | | | address/name. To implement this stderr has redirected to stdout - this doesn't need to be done but is the simplest implementation. Remove -t option since it doesn't seem to accomplish much but causes spurious messages to be displayed by ssh. Add explicit -h and --help options. Make style of usage message consistent with documentation. Document new features in doc/onnode.1.xml. (This used to be ctdb commit 8119238d1fa672814a7591593b517c3c42859315)
* Complete rewrite of tools/onnode. Remove old tools/onnode.ssh,Martin Schwenke2008-07-091-0/+194
tools/onnode.rsh. (This used to be ctdb commit 6b67f180668c7a05c941b4891bd2486601790165)