summaryrefslogtreecommitdiff
path: root/ctdb/tests/scripts
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-10-19 16:51:48 +1100
committerAmitay Isaacs <amitay@samba.org>2015-10-23 03:43:26 +0200
commita94378e3f1a0f94c2910ed084a5d182f3c0e38e3 (patch)
tree56a3702942492600325d54eafa87c3a927292d66 /ctdb/tests/scripts
parentc607989d91b64d837253aae794b1a3d6013eb3e0 (diff)
downloadsamba-a94378e3f1a0f94c2910ed084a5d182f3c0e38e3.tar.gz
ctdb-tests: Drop use of "ctdb delip -n all" in simple tests
Add new function delete_ip_from_all_nodes(). Also ctdb_get_all_pnns(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests/scripts')
-rw-r--r--ctdb/tests/scripts/integration.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 139a9a23cb2..a4d1de64085 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -229,6 +229,34 @@ get_test_ip_mask_and_iface ()
echo "$test_ip/$mask is on $iface"
}
+ctdb_get_all_pnns ()
+{
+ try_command_on_node -q all "$CTDB pnn | sed -e 's@PNN:@@'"
+ all_pnns="$out"
+}
+
+# The subtlety is that "ctdb delip" will fail if the IP address isn't
+# configured on a node...
+delete_ip_from_all_nodes ()
+{
+ _ip="$1"
+
+ ctdb_get_all_pnns
+
+ _nodes=""
+
+ for _pnn in $all_pnns ; do
+ all_ips_on_node $_pnn
+ while read _i _n ; do
+ if [ "$_ip" = "$_i" ] ; then
+ _nodes="${_nodes}${_nodes:+,}${_pnn}"
+ fi
+ done <<<"$out" # bashism
+ done
+
+ try_command_on_node -pq "$_nodes" "$CTDB delip $_ip"
+}
+
#######################################
# Wait until either timeout expires or command succeeds. The command