summaryrefslogtreecommitdiff
path: root/scripts/VyattaClusterConfig.pm
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/VyattaClusterConfig.pm')
-rw-r--r--scripts/VyattaClusterConfig.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/VyattaClusterConfig.pm b/scripts/VyattaClusterConfig.pm
index c6e7991..08c31de 100644
--- a/scripts/VyattaClusterConfig.pm
+++ b/scripts/VyattaClusterConfig.pm
@@ -15,6 +15,8 @@ my $DEFAULT_MCAST_GROUP = '239.251.252.253';
my $DEFAULT_UDP_PORT = '694';
my $DEFAULT_TTL = '1';
+my $HA_WATCHLINK_ID = 'ha';
+
my %fields = (
_interface => undef,
_mcast_grp => undef,
@@ -336,6 +338,37 @@ EOS
return ($str, undef, @init_services);
}
+sub del_watchlink_exclude {
+ my $self = shift;
+ my $cmd = '/opt/vyatta/sbin/vyatta-watchlink-exclude.pl '
+ . "--id=$HA_WATCHLINK_ID --action=remove >&/dev/null";
+ system($cmd);
+}
+
+sub add_watchlink_exclude {
+ my $self = shift;
+ my $bcmd = '/opt/vyatta/sbin/vyatta-watchlink-exclude.pl '
+ . "--id=$HA_WATCHLINK_ID --action=add --intf='*'";
+ my @groups = keys %{$self->{_groups}};
+ my $hashref = $self->{_groups}->{$groups[0]};
+ my @ip_addresses = ();
+ foreach (@{$hashref->{_service}}) {
+ if (isValidIPSpec($_)) {
+ my $ip = (/^([^\/]+)\//) ? $1 : $_;
+ push @ip_addresses, $ip;
+ }
+ }
+ return if (scalar(@ip_addresses) <= 0);
+
+ my $last_ip = pop @ip_addresses;
+ foreach (@ip_addresses) {
+ my $cmd = "$bcmd --ipadd=$_";
+ system($cmd);
+ }
+ my $cmd = "$bcmd --ipadd=$last_ip --signal";
+ system($cmd);
+}
+
sub print_str {
my ($self) = @_;
my $str = "cluster";