[SCM] CTDB repository - branch master updated - ctdb-1.0.96-3-g82fad66
Ronnie Sahlberg
sahlberg at samba.org
Fri Oct 16 00:30:11 MDT 2009
The branch, master has been updated
via 82fad66123c1b8c5d4ed3b19c39acf6f367b3f37 (commit)
via e62928f56ce8927b1d8686db2c31538c86462d1a (commit)
via 46474e5f21fd97dd765c616647ff46055a9970e7 (commit)
from 536229fd120bc3fdc2419e22d3bd6ab243dd6667 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 82fad66123c1b8c5d4ed3b19c39acf6f367b3f37
Merge: 536229fd120bc3fdc2419e22d3bd6ab243dd6667 e62928f56ce8927b1d8686db2c31538c86462d1a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 14 15:51:57 2009 +1100
Merge commit 'martins/onnode_options'
commit e62928f56ce8927b1d8686db2c31538c86462d1a
Merge: 46474e5f21fd97dd765c616647ff46055a9970e7 343c005367789e108c0320e95d7a264535d68dd8
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Oct 14 13:49:30 2009 +1100
Merge commit 'origin/master' into onnode_options
commit 46474e5f21fd97dd765c616647ff46055a9970e7
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Oct 14 13:44:57 2009 +1100
New onnode options: -f to specify nodes file, -n to allow use of hostnames.
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 at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
tools/onnode | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/tools/onnode b/tools/onnode
index 79623a4..7c0a86e 100755
--- a/tools/onnode
+++ b/tools/onnode
@@ -34,11 +34,14 @@ Usage: onnode [OPTION] ... <NODES> <COMMAND> ...
-o <prefix> Save standard output from each node to file <prefix>.<ip>
-p Run command in parallel on specified nodes.
-q Do not print node addresses (overrides -v).
+ -n Allow nodes to be specified by name.
+ -f Specify nodes file, overrides CTDB_NODES_FILE.
-v Print node address even for a single node.
<NODES> "all", "any", "ok" (or "healthy"), "con" (or "connected"),
"rm" (or "recmaster"), "lvs" (or "lvsmaster"),
- "natgw" (or "natgwlist");
- or a node number (0 base); or
+ "natgw" (or "natgwlist"); or
+ a node number (0 base); or
+ a hostname (if -n is specified); or
list (comma separated) of <NODES>; or
range (hyphen separated) of node numbers.
EOF
@@ -58,13 +61,14 @@ parallel=false
verbose=false
quiet=false
prefix=""
+names_ok=false
parse_options ()
{
# $POSIXLY_CORRECT means that the command passed to onnode can
# take options and getopt won't reorder things to make them
# options ot onnode.
- local temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cho:pqv" -l help -- "$@")
+ local temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqv" -l help -- "$@")
[ $? != 0 ] && usage
@@ -73,6 +77,8 @@ parse_options ()
while true ; do
case "$1" in
-c) current=true ; shift ;;
+ -f) CTDB_NODES_FILE="$2" ; shift 2 ;;
+ -n) names_ok=true ; shift ;;
-o) prefix="$2" ; shift 2 ;;
-p) parallel=true ; shift ;;
-q) quiet=true ; shift ;;
@@ -115,7 +121,7 @@ parse_nodespec ()
all|any|ok|healthy|con|connected) echo "$i" ;;
rm|recmaster|lvs|lvsmaster|natgw|natgwlist) echo "$i" ;;
*)
- [ $i -gt -1 ] 2>/dev/null || invalid_nodespec
+ [ $i -gt -1 ] 2>/dev/null || $names_ok || invalid_nodespec
echo $i
esac
done
@@ -223,7 +229,7 @@ get_nodes ()
if [ -n "$CTDB_NODES_SOCKETS" ] ; then
all_nodes="$CTDB_NODES_SOCKETS"
else
- [ -f "$CTDB_NODES_FILE" ] || CTDB_NODES_FILE=/etc/ctdb/nodes
+ [ -e "$CTDB_NODES_FILE" ] || CTDB_NODES_FILE=/etc/ctdb/nodes
all_nodes=$(sed -e 's@#.*@@g' -e 's@ *@@g' -e 's@^$@#DEAD@' $CTDB_NODES_FILE)
fi
@@ -253,10 +259,13 @@ get_nodes ()
natgw|natgwlist)
get_node_with_property "$all_nodes" "natgwlist" || exit 1
;;
- *)
+ [0-9]|[0-9][0-9]|[0-9][0-9][0-9])
echo_nth $n $all_nodes
+ ;;
+ *)
+ $names_ok || invalid_nodespec
+ echo $n
esac
-
done
}
--
CTDB repository
More information about the samba-cvs
mailing list