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

Andrew Beekhof beekhof at gmail.com
Thu Dec 21 01:10:37 MST 2006


why not add an extra resource and some ordering constraints?

On 12/20/06, Andreas Kurz <andreas.kurz at gmail.com> wrote:
> 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
> _______________________________________________
> Linux-HA mailing list
> Linux-HA at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>


More information about the Linux-HA mailing list