scripts: Replace uses of "ctdb pnn" with ctdb_get_pnn()
authorMartin Schwenke <martin@meltin.net>
Sun, 19 Apr 2015 09:45:41 +0000 (19:45 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 24 Feb 2016 10:44:27 +0000 (21:44 +1100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(Imported from commit 1092f9755fed331251ae508f1e04e85dc47ae902)

config/events.d/11.natgw
config/events.d/62.cnfs
config/events.d/91.lvs
config/functions

index 5e10d1d0c10f0e8641e0dcc2f47c8a04926e0723..62fa44eeac8d0ece911fa6c84b30cf139781f095 100755 (executable)
@@ -135,14 +135,14 @@ case "$1" in
     updatenatgw|ipreallocated)
        natgw_check_config
 
-       mypnn=$(ctdb pnn | cut -d: -f2)
+       ctdb_get_pnn
 
        natgw_set_capability
        natgw_ensure_master
 
        natgw_clear
 
-       if [ "$mypnn" = "$natgwmaster" ]; then
+       if [ "$pnn" = "$natgwmaster" ]; then
            natgw_set_master
        else
            natgw_set_slave "$natgwip"
index a6ca0c47e2527f2f6710668517f38bc33eb3a379..a3e666c7fdcc0078eb9a84c6458d9d8bd4ef0e5d 100755 (executable)
@@ -52,8 +52,8 @@ case "$1" in
         ctdb eventscript monitor
 
         # Wait until we no longer serve any ip addresses at all
-        PNN=`ctdb pnn | cut -d: -f2`
-        while `ctdb -X ip | cut -d'|' -f3 | egrep "^$PNN$" >/dev/null`; do
+       ctdb_get_pnn
+       while `ctdb -X ip | cut -d'|' -f3 | egrep "^$pnn$" >/dev/null`; do
                 sleep 1
         done
         ;;
index bdbcfa3db382348f90f5079d9e45e50bb351a343..47adf33c6d0c34288dd29283c0562b301a8151d8 100755 (executable)
@@ -46,10 +46,10 @@ case "$1" in
        ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
        kill_tcp_connections_local_only $CTDB_LVS_PUBLIC_IP
 
-       PNN=`ctdb pnn | sed -e "s/.*PNN://"`
+       ctdb_get_pnn
        LVSMASTER=`ctdb lvsmaster | sed -e "s/.*Node //" -e "s/ .*//"`
 
-       [ "$PNN" != "$LVSMASTER" ] && {
+       [ "$pnn" != "$LVSMASTER" ] && {
            # we are not the lvs master so we have to
            # change the ip address to have scope host so we wont respond
            # to arps
@@ -66,7 +66,7 @@ case "$1" in
        ipvsadm -A -u $CTDB_LVS_PUBLIC_IP:0 -p 1999999 -s lc
 
        # add all nodes (except ourselves) to the lvs config
-       ctdb lvs | egrep -v "^$PNN:" | sed -e "s/.*://" | while read IP; do
+       ctdb lvs | egrep -v "^${pnn}:" | sed -e "s/.*://" | while read IP; do
                ipvsadm -a -t $CTDB_LVS_PUBLIC_IP:0 -r $IP -g
                ipvsadm -a -u $CTDB_LVS_PUBLIC_IP:0 -r $IP -g
        done
index b0bc5e65b7b30eeb296f24b30335212cd016eb19..031d59ddbcf2f6aaefbfdae0d71e993594fbdd91 100644 (file)
@@ -1485,11 +1485,10 @@ update_tickles ()
        tickledir="$CTDB_VARDIR/state/tickles"
        mkdir -p "$tickledir"
 
-       # Who am I?
-       _pnn=$(ctdb pnn) ; _pnn=${_pnn#PNN:}
+       ctdb_get_pnn
 
        # What public IPs do I hold?
-       _ips=$(ctdb -X ip | awk -F'|' -v pnn=$_pnn '$3 == pnn {print $2}')
+       _ips=$(ctdb -X ip | awk -F'|' -v pnn=$pnn '$3 == pnn {print $2}')
 
        # IPs as a regexp choice
        _ipschoice="($(echo $_ips | sed -e 's/ /|/g' -e 's/\./\\\\./g'))"