Issue :
Need to add Multiple routes for an IP Resource.
Description:
Requirement is to add multiple routes to an IP resource. By default, IP Resource accepts only one route using IPRouteOptions . POSTONLINE trigger is helpful to over come this problem.
postonline trigger:
Invoked after the service group is online.
Example : Adding POSTONLINE trigger in below SG.
group ecds_web_01 (
SystemList = { lcnecdsdb01u = 0, lcnecdsdb02u = 1 }
AutoStartList = { lcnecdsdb01u, lcnecdsdb02u }
)
Steps:
1) Check if you have any POSTONLINE trigger file in triggers directory
# ls -l /opt/VRTSvcs/bin/triggers/
2) If no POSTONLINE file is there then copy a sample trigger file as below to the main trigger location.
# cp /opt/VRTSvcs/bin/sample_triggers/VRTSvcs/postonline /opt/VRTSvcs/bin/triggers/
3) Go to /opt/VRTSvcs/bin/triggers/ and create a file containing your command which you want to run in POSTONLINE.
Example : - Created routeadd.sh file "/opt/VRTSvcs/bin/triggers/routeadd.sh".
4) Go to /opt/VRTSvcs/bin/triggers/ and open POSTONLINE file and append below line before exit of script.
system("/opt/VRTSvcs/bin/triggers/<yoursamplescript>");
Example :- system("/opt/VRTSvcs/bin/triggers/routeadd.sh");
==============================================
File will looks line :
[root@server101 triggers]# cat postonline
……
……
system("/opt/VRTSvcs/bin/triggers/routeadd.sh");
exit;
[root@server101 triggers]#
====================================
Now, Enable the Trigger at Service Group level :
5) Enabling Trigger at SG
hagrp -modify <Service group name > TriggersEnabled POSTONLINE
===============================================
Service Group look like :
group ecds_web_01 (
SystemList = { lcnecdsdb01u = 0, lcnecdsdb02u = 1 }
AutoStartList = { lcnecdsdb01u, lcnecdsdb02u }
TriggersEnabled = { POSTONLINE }
)
========================================
Sample file of routeadd.sh for adding three routes :
Syntax : ip route add <IP> src <Gateway> dev eth0
#!/bin/bash
ip route add 10.x.x.36 src x.x.x.x dev bond0
ip route add 10.x.x.35 src x.x.x.x dev bond0
ip route add 10.x.x.42 src x.x.x.x dev bond0
========================================