[Linux-HA] local_start/stop_script -- small patch for IPaddr2

Andreas Kurz andreas.kurz at gmail.com
Wed Dec 20 07:28:00 MST 2006


Hello!

I found the option for the "local_start_script" and
"local_stop_script" from the IPaddr resource script very handy and
updated the IPaddr2 script. Belows the patch.

Regards,
Andi

--- IPaddr2     2006-08-14 17:52:20.000000000 +0200
+++ IPaddr2.new 2006-12-20 14:54:51.000000000 +0100
@@ -56,6 +56,8 @@
 #      OCF_RESKEY_arp_count
 #      OCF_RESKEY_arp_bg
 #      OCF_RESKEY_arp_mac
+#       OCF_RESKEY_local_start_script
+#       OCF_RESKEY_local_stop_script


 #######################################################################
@@ -229,6 +231,22 @@
 <content type="string" default="ffffffffffff"/>
 </parameter>

+<parameter name="local_start_script">
+<longdesc lang="en">
+Full path to a script that is called before the IP is added.
+</longdesc>
+<shortdesc lang="en">Script called before the IP is added</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
+<parameter name="local_stop_script">
+<longdesc lang="en">
+Full path to a script that is called before the IP is released.
+</longdesc>
+<shortdesc lang="en">Script called before the IP is released</shortdesc>
+<content type="string" default=""/>
+</parameter>
+
 </parameters>

 <actions>
@@ -413,7 +431,7 @@
        broadcast="$3"
        iface="$4"
        label="$5"
-
+
        CMD="$IP2UTIL -f inet addr add $ipaddr/$netmask brd $broadcast
dev $iface"

        if [ ! -z "$label" ]; then
@@ -612,6 +630,12 @@
                                ;;
                        esac
                fi
+
+               if [ ! -z "${OCF_RESKEY_local_start_script}" ]; then
+                       if [ -x "${OCF_RESKEY_local_start_script}" ]; then
+                               ${OCF_RESKEY_local_start_script} $*
+                       fi
+               fi

                add_interface $BASEIP $NETMASK $BRDCAST $NIC $IFLABEL

@@ -673,6 +697,12 @@
                fi
        fi

+       if [ ! -z "${OCF_RESKEY_local_stop_script}" ]; then
+               if [ -x "${OCF_RESKEY_local_stop_script}" ]; then
+                       ${OCF_RESKEY_local_stop_script} $*
+               fi
+       fi
+
        if [ "$ip_del_if" = "yes" ]; then
                delete_interface $BASEIP $NIC
                if [ $? -ne 0 ]; then


More information about the Linux-HA mailing list