summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2008-06-19 14:34:14 -0700
committerStig Thormodsrud <stig@vyatta.com>2008-06-19 14:34:14 -0700
commitd98f4100b278761efd067479c7c8ed8c0eddedf1 (patch)
tree23acd61569f627ead2767151ed5aefeed919e0c1
parent0d0a70245a9d0399c39843547ce5b63b72a1ab35 (diff)
downloadvyatta-cfg-system-d98f4100b278761efd067479c7c8ed8c0eddedf1.tar.gz
vyatta-cfg-system-d98f4100b278761efd067479c7c8ed8c0eddedf1.zip
Fix 2030: Enhancement: VRRP preemption hold down timer
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl7
-rwxr-xr-xscripts/keepalived/vyatta-show-vrrp.pl8
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def6
-rw-r--r--templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def6
4 files changed, 23 insertions, 4 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index ada5e367..c41fa7e2 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -74,6 +74,10 @@ sub keepalived_get_values {
if (!defined $preempt) {
$preempt = "true";
}
+ my $preempt_delay = $config->returnValue("preempt-delay");
+ if (defined $preempt_delay and $preempt eq "false") {
+ print "Warning: preempt delay is ignored when preempt=false\n";
+ }
my $advert_int = $config->returnValue("advertise-interval");
if (!defined $advert_int) {
$advert_int = 1;
@@ -121,6 +125,9 @@ sub keepalived_get_values {
if ($preempt eq "false") {
$output .= "\tnopreempt\n";
}
+ if (defined $preempt_delay) {
+ $output .= "\tpreempt_delay $preempt_delay\n";
+ }
$output .= "\tadvert_int $advert_int\n";
if (defined $auth_type) {
$output .= "\tauthentication {\n";
diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl
index 98fb376e..e8157d21 100755
--- a/scripts/keepalived/vyatta-show-vrrp.pl
+++ b/scripts/keepalived/vyatta-show-vrrp.pl
@@ -130,8 +130,8 @@ sub get_master_info {
}
if ( -f $master_file) {
- my $master_ip = `grep ip.src $master_file`;
- my $master_mac = `grep eth.src $master_file`;
+ my $master_ip = `grep ip.src $master_file 2> /dev/null`;
+ my $master_mac = `grep eth.src $master_file 2> /dev/null`;
chomp $master_ip; chomp $master_mac;
# regex for show="xx:xx:xx:xx:xx:xx
@@ -141,7 +141,7 @@ sub get_master_info {
$master_mac = uc($1);
if ($arp_mac ne $master_mac) {
VyattaKeepalived::snoop_for_master($intf, $group, $vip, 2);
- $master_ip = `grep ip.src $master_file`;
+ $master_ip = `grep ip.src $master_file 2> /dev/null`;
}
}
@@ -154,7 +154,7 @@ sub get_master_info {
system("mv $master_file /tmp");
}
- my $priority = `grep vrrp.prio $master_file`;
+ my $priority = `grep vrrp.prio $master_file 2> /dev/null`;
chomp $priority;
if (defined $priority and $priority =~ m/show=\"(\d+)\"/) {
$priority = $1;
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def
new file mode 100644
index 00000000..1638624e
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def
@@ -0,0 +1,6 @@
+type: u32
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 1000; \
+ "preempt-delay must be between 0-1000"
+help: Set preempt-delay
+comp_help: possible completions:
+ <0-1000> Set Preempt Delay in seconds
diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def
new file mode 100644
index 00000000..1638624e
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/preempt-delay/node.def
@@ -0,0 +1,6 @@
+type: u32
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 1000; \
+ "preempt-delay must be between 0-1000"
+help: Set preempt-delay
+comp_help: possible completions:
+ <0-1000> Set Preempt Delay in seconds