]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
use a subdirectory for ctdb state files
authorAndrew Tridgell <tridge@samba.org>
Fri, 1 Jun 2007 09:16:58 +0000 (19:16 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Jun 2007 09:16:58 +0000 (19:16 +1000)
(This used to be ctdb commit 71ebf272be42e313715f0f100be9f5567127eb73)

ctdb/tools/events
ctdb/tools/statd-callout

index 0a57cbe87f42ed30c2819f69b86083c6c8342eea..bf38bae469bc6baecc1afa10dae920c8aa50ce48 100755 (executable)
@@ -8,6 +8,8 @@ shift
 
 case $cmd in 
      startup)
+       /bin/rm -rf /etc/ctdb/state
+       /bin/mkdir -p /etc/ctdb/state
        # wait for local services to come up.
        [ -z "$CTDB_WAIT_TCP_PORTS" ] || {
          all_ok=0
@@ -58,15 +60,15 @@ case $cmd in
                 echo "`/bin/date` Failed to add $ip/$maskbits on dev $iface"
                 exit 1
        }
-       echo $ip >> /etc/ctdb/taken_ips
-       echo $ip >> /etc/ctdb/changed_ips
+       echo $ip >> /etc/ctdb/state/taken_ips
+       echo $ip >> /etc/ctdb/state/changed_ips
 
-       # if we have a local arp entry for this IP then remove it
-       /sbin/arp -d $ip 2> /dev/null
+       # flush our route cache
+       echo 1 > /proc/sys/net/ipv4/route/flush
 
        # having a list of what IPs we have allows statd to do the right 
        # thing via /etc/ctdb/statd-callout
-       /bin/touch /etc/ctdb/ip.$ip
+       /bin/touch /etc/ctdb/state/ip.$ip
        exit 0
        ;;
 
@@ -82,30 +84,32 @@ case $cmd in
                 echo "`/bin/date` Failed to del $ip on dev $iface"
                 exit 1
        }
-       # if we have a local arp entry for this IP then remove it
-       /sbin/arp -d $ip 2> /dev/null
-       echo $ip >> /etc/ctdb/released_ips
-       echo $ip >> /etc/ctdb/changed_ips
-       /bin/rm -f /etc/ctdb/ip.$ip
+
+       # flush our route cache
+       echo 1 > /proc/sys/net/ipv4/route/flush
+
+       echo $ip >> /etc/ctdb/state/released_ips
+       echo $ip >> /etc/ctdb/state/changed_ips
+       /bin/rm -f /etc/ctdb/state/ip.$ip
        exit 0
        ;;
 
      recovered)
        # if we have taken or released any ips we must send out
        # statd notifications to recover lost nfs locks
-       [ -x /etc/ctdb/statd-callout ] && [ -f /etc/ctdb/changed_ips ] && {
+       [ -x /etc/ctdb/statd-callout ] && [ -f /etc/ctdb/state/changed_ips ] && {
                /etc/ctdb/statd-callout notify &
        } >/dev/null 2>&1
 
         # restart NFS to ensure that all TCP connections to the released ip
        # are closed
-       [ -f /etc/ctdb/released_ips ] && {
+       [ -f /etc/ctdb/state/released_ips ] && {
                ( /sbin/service nfs status > /dev/null 2>&1 && 
                       /sbin/service nfs restart > /dev/null 2>&1 ) &
        } > /dev/null 2>&1
-       /bin/rm -f /etc/ctdb/changed_ips
-       /bin/rm -f /etc/ctdb/released_ips
-       /bin/rm -f /etc/ctdb/taken_ips
+       /bin/rm -f /etc/ctdb/state/changed_ips
+       /bin/rm -f /etc/ctdb/state/released_ips
+       /bin/rm -f /etc/ctdb/state/taken_ips
        exit 0
        ;;
 
index 12ecf388aadd7cbd76e6c4d187d6ce4d6c225fd6..d17534efb3a8bb9cc5c895dcf9c3b11ef2c84a38 100755 (executable)
@@ -8,7 +8,7 @@
 
 case "$1" in
   add-client)
-        for f in `/bin/ls /etc/ctdb/ip.*`; do
+        for f in `/bin/ls /etc/ctdb/state/ip.*`; do
            fname=`/bin/basename $f`
            ip=`echo $fname | cut -d. -f2-`
            [ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip
@@ -16,7 +16,7 @@ case "$1" in
        done
        ;;
   del-client)
-        for f in `/bin/ls /etc/ctdb/ip.*`; do
+        for f in `/bin/ls /etc/ctdb/state/ip.*`; do
            fname=`/bin/basename $f`
            ip=`echo $fname | cut -d. -f2-`
            /bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
@@ -27,7 +27,7 @@ case "$1" in
        /sbin/service nfslock stop > /dev/null 2>&1 
        /sbin/service nfslock start > /dev/null 2>&1 
        # send out notifications to any additional ips we now serve
-        for f in `/bin/ls /etc/ctdb/ip.*`; do
+        for f in `/bin/ls /etc/ctdb/state/ip.*`; do
            fname=`/bin/basename $f`
            ip=`echo $fname | cut -d. -f2-`
            [ -d $STATD_SHARED_DIRECTORY/$ip ] && {