From dfe8de9e4a6a22fd0dc8e0ce7f74df9d0cba9491 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 13 Apr 2016 17:47:45 +1000 Subject: [PATCH] ctdb-scripts: Simplify "ctdb lvs ..." output For "master", if there is a master then print the PNN, otherwise print nothing. For "list", print the PNN and IP addresses without a colon in between. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/config/events.d/91.lvs | 4 ++-- ctdb/doc/ctdb.1.xml | 6 +++--- ctdb/tests/eventscripts/stubs/ctdb_lvs | 5 ++--- ctdb/tests/tool/stubby.lvs.001.sh | 1 - ctdb/tests/tool/stubby.lvs.002.sh | 8 ++++---- ctdb/tests/tool/stubby.lvs.003.sh | 6 +++--- ctdb/tests/tool/stubby.lvs.004.sh | 6 +++--- ctdb/tests/tool/stubby.lvs.005.sh | 8 ++++---- ctdb/tests/tool/stubby.lvs.006.sh | 4 ++-- ctdb/tests/tool/stubby.lvs.007.sh | 1 - ctdb/tools/ctdb_lvs | 23 ++--------------------- 11 files changed, 25 insertions(+), 47 deletions(-) diff --git a/ctdb/config/events.d/91.lvs b/ctdb/config/events.d/91.lvs index 528121ed44a..141f96458e0 100755 --- a/ctdb/config/events.d/91.lvs +++ b/ctdb/config/events.d/91.lvs @@ -81,7 +81,7 @@ ipreallocated) "$CTDB_LVS_PUBLIC_IFACE" "$CTDB_LVS_PUBLIC_IP" ctdb_get_pnn - lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master | sed -n -e 's/Node \([0-9]*\) is LVS master/\1/p') + lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master) if [ "$pnn" != "$lvsmaster" ] ; then # This node is not the LVS master so change the IP address # to have scope "host" so this node won't respond to ARPs @@ -99,7 +99,7 @@ ipreallocated) # Add all nodes (except this node) as LVS servers "${CTDB_HELPER_BINDIR}/ctdb_lvs" list | - awk -F: -v pnn="$pnn" '$1 != pnn { print $2 }' | + awk -v pnn="$pnn" '$1 != pnn { print $2 }' | while read ip ; do ipvsadm -a -t "$CTDB_LVS_PUBLIC_IP" -r $ip -g ipvsadm -a -u "$CTDB_LVS_PUBLIC_IP" -r $ip -g diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index 326c69580a0..20dcba09e08 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -743,7 +743,7 @@ MonitorInterval = 15 Example output: -Node 2 is LVS master +2 @@ -757,8 +757,8 @@ Node 2 is LVS master Example output: -2:10.0.0.13 -3:10.0.0.14 +2 10.0.0.13 +3 10.0.0.14 diff --git a/ctdb/tests/eventscripts/stubs/ctdb_lvs b/ctdb/tests/eventscripts/stubs/ctdb_lvs index daca8e229fa..5dfb24901e3 100755 --- a/ctdb/tests/eventscripts/stubs/ctdb_lvs +++ b/ctdb/tests/eventscripts/stubs/ctdb_lvs @@ -27,10 +27,9 @@ not_implemented () ctdb_lvs_master () { if [ -n "$FAKE_CTDB_LVS_MASTER" ] ; then - echo "Node ${FAKE_CTDB_LVS_MASTER} is LVS master" + echo "$FAKE_CTDB_LVS_MASTER" return 0 else - echo "This is no LVS master" return 255 fi } @@ -39,7 +38,7 @@ ctdb_lvs_list () { _pnn=0 while read _ip _opts ; do - echo "${_pnn}:${_ip}" + echo "${_pnn} ${_ip}" _pnn=$(($_pnn + 1)) done <"$CTDB_LVS_NODES" } diff --git a/ctdb/tests/tool/stubby.lvs.001.sh b/ctdb/tests/tool/stubby.lvs.001.sh index 46fbef55fea..3e864625e23 100755 --- a/ctdb/tests/tool/stubby.lvs.001.sh +++ b/ctdb/tests/tool/stubby.lvs.001.sh @@ -28,7 +28,6 @@ VNNMAP ##### required_result 255 <