tools/onnode: Fix healthy/ok node handling
authorMartin Schwenke <martin@meltin.net>
Thu, 24 Oct 2013 03:15:53 +0000 (14:15 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 29 Oct 2013 06:14:55 +0000 (17:14 +1100)
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)

ctdb/tests/onnode/0070.sh
ctdb/tests/onnode/0071.sh
ctdb/tests/onnode/0075.sh
ctdb/tools/onnode

index 902d78b23159f4ea7190a2326fca6218df844bb4..b071e80a800f1b73a344d00acb385cf374bdb9cc 100755 (executable)
@@ -7,11 +7,11 @@ cmd="$ONNODE ok hostname"
 define_test "$cmd" "all nodes OK"
 
 ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:
-:0:192.168.1.101:0:0:0:0:0:0:
-:1:192.168.1.102:0:0:0:0:0:0:
-:2:192.168.1.103:0:0:0:0:0:0:
-:3:192.168.1.104:0:0:0:0:0:0:
+:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
+:0:192.168.1.101:0:0:0:0:0:0:0:Y:
+:1:192.168.1.102:0:0:0:0:0:0:0:N:
+:2:192.168.1.103:0:0:0:0:0:0:0:N:
+:3:192.168.1.104:0:0:0:0:0:0:0:N:
 EOF
 
 required_result <<EOF
index ebf2f61fcd7a60536f51446f1f236f44df7b6040..d594323e3fd2f4c128a3f4132325b53c7caaaf80 100755 (executable)
@@ -6,13 +6,12 @@ cmd="$ONNODE ok hostname"
 
 define_test "$cmd" "2nd node disconnected"
 
-ctdb_set_output  <<EOF 
-ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:
-:0:192.168.1.101:0:0:0:0:0:0:
-:1:192.168.1.102:1:0:0:0:0:0:
-:2:192.168.1.103:0:0:0:0:0:0:
-:3:192.168.1.104:0:0:0:0:0:0:
+ctdb_set_output <<EOF 
+:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
+:0:192.168.1.101:0:0:0:0:0:0:0:Y:
+:1:192.168.1.102:1:0:0:0:0:0:0:N:
+:2:192.168.1.103:0:0:0:0:0:0:0:N:
+:3:192.168.1.104:0:0:0:0:0:0:0:N:
 EOF
 
 required_result <<EOF
index 6ce9b9b190eb0db41436297482e7b59b238f7466..4276e9c12c873581125955ef9d1d45d332279e68 100755 (executable)
@@ -7,11 +7,11 @@ cmd="$ONNODE con hostname"
 define_test "$cmd" "1st node disconnected"
 
 ctdb_set_output <<EOF
-:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:
-:0:192.168.1.101:1:0:0:0:0:0:
-:1:192.168.1.102:0:0:0:0:0:0:
-:2:192.168.1.103:0:0:0:0:0:0:
-:3:192.168.1.104:0:0:0:0:0:0:
+:Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:ThisNode:
+:0:192.168.1.101:1:0:0:0:0:0:0:N:
+:1:192.168.1.102:0:0:0:0:0:0:0:Y:
+:2:192.168.1.103:0:0:0:0:0:0:0:N:
+:3:192.168.1.104:0:0:0:0:0:0:0:N:
 EOF
 
 required_result <<EOF
index 11ad70869321ca404c13b07148077bc2191b13da..0abc13636ef663f0157710f16a88c9282a9c1b34 100755 (executable)
@@ -165,10 +165,10 @@ get_nodes_with_status ()
 
            case "$status" in
                healthy)
-                   # If any bit is not 0, don't match this address.
+                   # If any bit is 1, don't match this address.
                    local s
                    for s ; do
-                       [ "$s" = "0" ] || continue 2
+                       [ "$s" != "1" ] || continue 2
                    done
                    ;;
                connected)