------------------------------------------------------------
revno: 418
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Andrew Tridgell <[EMAIL PROTECTED]>
branch nick: tridge
timestamp: Fri 2007-06-01 19:16:58 +1000
message:
  use a subdirectory for ctdb state files
modified:
  tools/events                   events-20070529030121-04fjh63cxfh8v1pj-1
  tools/statd-callout            statdcallout-20070531010857-6sdlz455vusye5y5-1
=== modified file 'tools/events'
--- a/tools/events      2007-06-01 05:23:16 +0000
+++ b/tools/events      2007-06-01 09:16:58 +0000
@@ -8,6 +8,8 @@
 
 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 @@
                 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 @@
                 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
        ;;
 

=== modified file 'tools/statd-callout'
--- a/tools/statd-callout       2007-06-01 03:14:05 +0000
+++ b/tools/statd-callout       2007-06-01 09:16:58 +0000
@@ -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 @@
        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 @@
        /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 ] && {

Reply via email to