[SOLVED] vyatta 6.5R1 VRRP transitions scripts and keepalived.conf

5 posts / 0 new
Last post
ramcluster
[SOLVED] vyatta 6.5R1 VRRP transitions scripts and keepalived.conf

Hi all

I have set up a lab with virtual machines with Vyatta 6.5R1 VC, and trying VRRP, with transitions scripts.
Everything is correct in the configuration file, I can see the directive "run-transition-scripts" with fault, master and backup pointing to the scripts under /config/scripts/
But tests goes wrong, nothing happens when change vrrp state.
I have looked at keepalived.conf and everything is there as expected, except directives related with scripts to run when transition of vrrp states,that is

notify_fault, notify_master and notify_backup

they dont show up in the keepalived.conf config file, so this is why dont work.

What could it be??

Thank you very much.

john.southworth
Can you provide your vyatta

Can you provide your vyatta configuration for the interfaces in question and the /etc/keepalived/keepalived.conf file?

ramcluster
Hi

Hi

This is the piece of code of the interface set up with vrrp
[code:1:543e917b54]
interfaces {
ethernet eth0 {
address 192.168.0.2/24
hw-id 00:0c:29:66:66:18
vrrp {
vrrp-group 2 {
run-transitions-scripts {
fault test.script
}
virtual-address 192.168.0.1/24
}
}
}
loopback lo {
}
}
[/code:1:543e917b54]

Very simple. I have tried putting full path, that is /config/scripts/test.script, but no luck.
Now the config as is shown in keepalived.conf
[code:1:543e917b54]

global_defs {
enable_traps
}
vrrp_instance vyatta-eth0-2 {
state BACKUP
interface eth0
virtual_router_id 2
priority 100
advert_int 1
virtual_ipaddress {
192.168.0.1/24
}
}
[/code:1:543e917b54]

As can be seen every pretty simple. But the lines related with scripts doesn't appear.
I have checked in /opt/vyatta/config/active and the nodes are there correctly.

A config error? or some error when keepalived is generated?

Thank you very much.

john.southworth
There is a typo in /opt

There is a typo in /opt/vyatta/sbin/vyatta-keeepalived.pl that is causing your problem. It is preventing the fault script line from getting generated.
This patch:
[code:1:a1b4413d45]
diff --git a/scripts/vyatta-keepalived.pl b/scripts/vyatta-keepalived.pl
index 5697926..dadc429 100755
--- a/scripts/vyatta-keepalived.pl
+++ b/scripts/vyatta-keepalived.pl
@@ -309,7 +309,7 @@ sub keepalived_get_values {
$output .= "\tnotify_backup \"$state_transition_script backup ";
$output .= "$intf $group $transition_intf \'$run_backup_script\' @vips\" \n";
}
- if ($run_backup_script ne 'null') {
+ if ($run_fault_script ne 'null') {
$output .= "\tnotify_fault \"$state_transition_script fault ";
$output .= "$intf $group $transition_intf \'$run_fault_script\' @vips\" \n";
}
[/code:1:a1b4413d45]
Will fix it.

After this fix you should see a line 'notify_fault' in your keepalived.conf like:
[code:1:a1b4413d45]
[edit]
vyatta@vyatta# cat /etc/keepalived/keepalived.conf
#
# autogenerated by /opt/vyatta/sbin/vyatta-keepalived.pl
#

global_defs {
enable_traps
}
vrrp_instance vyatta-eth0-10 {
state BACKUP
interface eth0
virtual_router_id 10
use_vmac eth0v10
priority 100
advert_int 1
virtual_ipaddress {
10.0.0.1
}
notify_fault "/opt/vyatta/sbin/vyatta-vrrp-state.pl fault eth0 10 eth0v10 '/config/scripts/test.sh' 10.0.0.1"
}

[edit]
vyatta@vyatta# sh int e eth0 vrrp
vrrp-group 10 {
rfc3768-compatibility
run-transition-scripts {
fault /config/scripts/test.sh
}
virtual-address 10.0.0.1
}
[/code:1:a1b4413d45]

ramcluster
Hi

Hi

Before I patched the code, I found that if you added a backup transition script, in the keepalived.conf apperars a fault directive pointing to 'null' script.
Then I patched the vyatta-keepalived.pl with the patch provided by you, and everything seems to work. I have tried to add, delete different combinations of run-transition-scritps..
Are you going to add this patch to a future release of VC, when it would be? I think this is an important feature that should work on community edition.

Thank you very much