summaryrefslogtreecommitdiff
path: root/ctdb/tools/onnode
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2009-09-15 19:33:35 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-09-15 19:33:35 +1000
commit029fd6b00f8782362ec942e3b19de66233182da3 (patch)
tree458db1c631d9dc751dcf652f9dd9b1ddaba574b2 /ctdb/tools/onnode
parent59cacded72dc83d8cc81f840abf1801dcd361401 (diff)
downloadsamba-029fd6b00f8782362ec942e3b19de66233182da3.tar.gz
Revert "try to restart statd everytime it fails, not just the first time"
This reverts commit 4f7b39a4871af28df1c4545ec37db179fa47a7da. (This used to be ctdb commit db7b96304e4725f29b12398b7582e385daed63ed)
Diffstat (limited to 'ctdb/tools/onnode')
-rwxr-xr-xctdb/tools/onnode25
1 files changed, 23 insertions, 2 deletions
diff --git a/ctdb/tools/onnode b/ctdb/tools/onnode
index e00cd2b1d91..79623a4a3cb 100755
--- a/ctdb/tools/onnode
+++ b/ctdb/tools/onnode
@@ -35,7 +35,7 @@ Usage: onnode [OPTION] ... <NODES> <COMMAND> ...
-p Run command in parallel on specified nodes.
-q Do not print node addresses (overrides -v).
-v Print node address even for a single node.
- <NODES> "all", "ok" (or "healthy"), "con" (or "connected"),
+ <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
@@ -112,7 +112,7 @@ parse_nodespec ()
case "$i" in
*-*) seq "${i%-*}" "${i#*-}" 2>/dev/null || invalid_nodespec ;;
# Separate lines for readability.
- all|ok|healthy|con|connected) echo "$i" ;;
+ all|any|ok|healthy|con|connected) echo "$i" ;;
rm|recmaster|lvs|lvsmaster|natgw|natgwlist) echo "$i" ;;
*)
[ $i -gt -1 ] 2>/dev/null || invalid_nodespec
@@ -198,6 +198,24 @@ get_node_with_property ()
fi
}
+get_any_available_node ()
+{
+ local all_nodes="$1"
+
+ # We do a recursive onnode to find which nodes are up and running.
+ local out=$($0 -pq all ctdb pnn 2>&1)
+ local line
+ while read line ; do
+ local pnn="${line#PNN:}"
+ if [ "$pnn" != "$line" ] ; then
+ echo_nth "$pnn" $all_nodes
+ return 0
+ fi
+ # Else must be an error message from a down node.
+ done <<<"$out"
+ return 1
+}
+
get_nodes ()
{
local all_nodes
@@ -217,6 +235,9 @@ get_nodes ()
all)
echo "${all_nodes//#DEAD/}"
;;
+ any)
+ get_any_available_node "$all_nodes" || exit 1
+ ;;
ok|healthy)
get_nodes_with_status "$all_nodes" "healthy" || exit 1
;;