On 16-7-2012 14:55, Dan Frincu wrote: > Hi, > > On Mon, Jul 16, 2012 at 4:18 AM, Anne Blankert wrote: >> Hello list, >> >> I am a newbie playing with heartbeat / pacemaker on ubuntu 12.04 LTS. I >> have defined the following resource primitives and switchover/fail-over >> works almost fine. >> >> primitive ip1 ocf:heartbeat:IPaddr2 \ >> params ip="10.10.10.2" nic="eth0:0" >> primitive ip1arp ocf:heartbeat:SendArp \ >> params ip="10.10.10.2" nic="eth0:0" >> >> The firewall/router in the datacenter does not accept gratuitous ARP >> (according to the manual: to prevent ip-spoofing). However, as a >> work-around, I have a script that forces the router to reset the arp >> table for the virtual ip. How can I tell the crm to run this script when >> the IPaddr2 resource is moved? >> >> I found a parameter "local_start_script" that can be passed to >> ocf:IPaddr2, but the IPaddr2 script ignores this parameter. In a post to >> this list, a patch to IPaddr2 was proposed, but not accepted. >> >> primitive ip1 ocf:heartbeat:IPaddr2 \ >> params ip="10.10.10.2" nic="eth0:0" \ >> local_start_script="/home/user1/arpreset" >> >> There also exists the ocf:anything script, but this script expects a >> parameter 'binfile' that should point to a deamon, not a one shot script. >> >> So, is there a simple - best practice - way to run a one-shot script on >> switchover / fail-over / fail-back? > Make the script LSB compliant [1], and then add it to the > configuration or use the ocf:heartbeat:Dummy to create a RA out of > that script. On the long run, the second option might prove more > useful, but it depends on your specific requirements. > > HTH, > Dan > > [1] http://www.linux-ha.org/wiki/LSB_Resource_Agents The suggestion to take the ocf:heartbeat:Dummy script worked out fine. Steps I took:
1. cd /usr/lib/ocf/resource.d/heartbeat 2. cp Dummy ArpReset 3. edit file ArpReset and replace all 'dummy' by 'arpreset' and 'Dummy' by 'ArpReset' 4. insert the call(s) to the one-shot script(s) in file ArpReset arpreset_start() { arpreset_monitor if [ $? = $OCF_SUCCESS ]; then **** call script here **** sleep 4 **** call script again return $OCF_SUCCESS fi touch ${OCF_RESKEY_state} } 5. test if the script is correct ocf-tester -n resourcename ArpReset 6. crm configure edit primitive arpreset ocf:heartbeat:ArpReset group groupname resource1 resource2 arpreset colocation colocoationname inf: resource1 resource2 arpreset order ordername inf: resource1:start resource2:start arpreset:start Thanks, Anne _______________________________________________ Linux-HA mailing list Linux-HA@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems