When starting and stopping ctdb through the init-script, make sure we first clear...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 11 Aug 2011 01:45:59 +0000 (11:45 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 11 Aug 2011 01:45:59 +0000 (11:45 +1000)
CQ S1027550

config/ctdb.init

index 1dc051c7d3e68508f14908099d1ca7b5c5ba6dbc..d6493bd7db0d24072899878433f3eb2783df71ba 100755 (executable)
@@ -219,6 +219,16 @@ wait_until_ready () {
 
 ctdbd=${CTDBD:-/usr/sbin/ctdbd}
 
+drop_all_public_ips() {
+    [ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
+       return
+    }
+
+    cat $CTDB_PUBLIC_ADDRESSES | while read IP IFACE REST; do
+       ip addr del $IP dev $IFACE >/dev/null 2>/dev/null
+    done
+}
+
 start() {
     echo -n $"Starting ctdbd service: "
 
@@ -229,6 +239,10 @@ start() {
 
     build_ctdb_options
 
+    # make sure we drop any ips that might still be held if previous
+    # instance of ctdb got killed with -9 or similar
+    drop_all_public_ips
+
     check_persistent_databases || return $?
 
     if [ "$CTDB_SUPPRESS_COREFILE" = "yes" ]; then
@@ -309,6 +323,9 @@ stop() {
            pkill -9 -f $CTDB_BASE/events.d/
        }
     done
+    # make sure all ips are dropped, pfkill -9 might leave them hanging around
+    drop_all_public_ips
+
     case $init_style in
        suse)
            # re-set the return code to the recorded RETVAL in order
@@ -322,6 +339,7 @@ stop() {
            echo ""
            ;;
     esac
+
     return $RETVAL
 }