summaryrefslogtreecommitdiff
path: root/scripts/keepalived
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/keepalived')
-rw-r--r--scripts/keepalived/vyatta-clear-vrrp.pl22
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl8
-rwxr-xr-xscripts/keepalived/vyatta-show-vrrp.pl20
-rwxr-xr-xscripts/keepalived/vyatta-vrrp-state.pl16
4 files changed, 33 insertions, 33 deletions
diff --git a/scripts/keepalived/vyatta-clear-vrrp.pl b/scripts/keepalived/vyatta-clear-vrrp.pl
index be33f2b9..612dae5f 100644
--- a/scripts/keepalived/vyatta-clear-vrrp.pl
+++ b/scripts/keepalived/vyatta-clear-vrrp.pl
@@ -24,14 +24,14 @@
#
use lib "/opt/vyatta/share/perl5/";
-use VyattaKeepalived;
+use Vyatta::Keepalived;
use Getopt::Long;
use Sys::Syslog qw(:standard :macros);
use strict;
use warnings;
-my $conf_file = VyattaKeepalived::get_conf_file();
+my $conf_file = Vyatta::Keepalived::get_conf_file();
sub keepalived_write_file {
@@ -174,7 +174,7 @@ sub set_inital_state {
my ($tmp_conf, $match_instance) =
vrrp_extract_instance($conf, $instance);
if (defined $match_instance) {
- my $init = VyattaKeepalived::vrrp_get_init_state($intf, $group,
+ my $init = Vyatta::Keepalived::vrrp_get_init_state($intf, $group,
"", "false");
$match_instance = set_instance_inital_state($match_instance, $init);
$new_conf .= $match_instance . "\n\n";
@@ -207,12 +207,12 @@ my $login = getlogin();
#
if ($action eq "clear_process") {
syslog("warning", "clear vrrp process requested by $login");
- if (VyattaKeepalived::is_running()) {
+ if (Vyatta::Keepalived::is_running()) {
print "Restarting VRRP...\n";
- VyattaKeepalived::restart_daemon(VyattaKeepalived::get_conf_file());
+ Vyatta::Keepalived::restart_daemon(VyattaKeepalived::get_conf_file());
} else {
print "Starting VRRP...\n";
- VyattaKeepalived::start_daemon(VyattaKeepalived::get_conf_file());
+ Vyatta::Keepalived::start_daemon(VyattaKeepalived::get_conf_file());
}
exit 0;
}
@@ -239,21 +239,21 @@ if ($action eq "clear_master") {
}
my $instance = "vyatta-" . "$vrrp_intf" . "-" . "$vrrp_group";
- my $state_file = VyattaKeepalived::get_state_file($vrrp_intf, $vrrp_group);
+ my $state_file = Vyatta::Keepalived::get_state_file($vrrp_intf, $vrrp_group);
if (! -f $state_file) {
print "Invalid interface/group [$vrrp_intf][$vrrp_group]\n";
exit 1;
}
my ($start_time, $intf, $group, $state, $ltime) =
- VyattaKeepalived::vrrp_state_parse($state_file);
+ Vyatta::Keepalived::vrrp_state_parse($state_file);
if ($state ne "master") {
print "vrrp group $vrrp_group on $vrrp_intf is already in backup\n";
exit 1;
}
syslog("warning", "clear vrrp master [$instance] requested by $login");
- VyattaKeepalived::vrrp_log("vrrp clear_master $vrrp_intf $vrrp_group");
+ Vyatta::Keepalived::vrrp_log("vrrp clear_master $vrrp_intf $vrrp_group");
# should add a file lock
local($/, *FILE); # slurp mode
@@ -283,7 +283,7 @@ if ($action eq "clear_master") {
system("mv $conf_file $conf_file_bak");
system("cp $tmp_conf_file $conf_file");
- VyattaKeepalived::restart_daemon($conf_file);
+ Vyatta::Keepalived::restart_daemon($conf_file);
print "Forcing $vrrp_intf-$group to BACKUP...\n";
sleep(3);
@@ -294,7 +294,7 @@ if ($action eq "clear_master") {
$new_conf .= "\n" . $match_instance . "\n";
keepalived_write_file($conf_file, $new_conf);
- VyattaKeepalived::restart_daemon($conf_file);
+ Vyatta::Keepalived::restart_daemon($conf_file);
system("rm $conf_file_bak $tmp_conf_file");
exit 0;
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index a59f6832..b2f0ba3b 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -24,7 +24,7 @@
#
use lib "/opt/vyatta/share/perl5/";
-use VyattaConfig;
+use Vyatta::Config;
use Vyatta::Keepalived;
use Getopt::Long;
@@ -41,7 +41,7 @@ sub keepalived_get_values {
my ($intf, $path) = @_;
my $output = '';
- my $config = new VyattaConfig;
+ my $config = new Vyatta::Config;
my $state_transition_script = get_state_script();
@@ -188,7 +188,7 @@ sub vrrp_save_changes {
sub vrrp_find_changes {
my @list = ();
- my $config = new VyattaConfig;
+ my $config = new Vyatta::Config;
my $vrrp_instances = 0;
$config->setLevel("interfaces ethernet");
@@ -292,7 +292,7 @@ sub vrrp_update_config {
my $date = localtime();
my $output = "#\n# autogenerated by $0 on $date\n#\n\n";
- my $config = new VyattaConfig;
+ my $config = new Vyatta::Config;
$config->setLevel("interfaces ethernet");
my @eths = $config->listNodes();
diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl
index e8157d21..4b8d6fec 100755
--- a/scripts/keepalived/vyatta-show-vrrp.pl
+++ b/scripts/keepalived/vyatta-show-vrrp.pl
@@ -23,7 +23,7 @@
# **** End License ****
#
use lib "/opt/vyatta/share/perl5/";
-use VyattaKeepalived;
+use Vyatta::Keepalived;
use strict;
use warnings;
@@ -119,14 +119,14 @@ sub get_master_info {
# address and compare it to our masterfile. If it doesn't match
# then we will snoop for the new master.
- my $master_file = VyattaKeepalived::get_master_file($intf, $group);
+ my $master_file = Vyatta::Keepalived::get_master_file($intf, $group);
my $arp_file = "$master_file.arp";
system("/usr/bin/arping -c1 -f -I $intf $vip > $arp_file");
my $arp_mac = parse_arping($arp_file);
if ( ! -f $master_file) {
- VyattaKeepalived::snoop_for_master($intf, $group, $vip, 2);
+ Vyatta::Keepalived::snoop_for_master($intf, $group, $vip, 2);
}
if ( -f $master_file) {
@@ -140,7 +140,7 @@ sub get_master_info {
{
$master_mac = uc($1);
if ($arp_mac ne $master_mac) {
- VyattaKeepalived::snoop_for_master($intf, $group, $vip, 2);
+ Vyatta::Keepalived::snoop_for_master($intf, $group, $vip, 2);
$master_ip = `grep ip.src $master_file 2> /dev/null`;
}
}
@@ -172,11 +172,11 @@ sub vrrp_showsummary {
my ($file) = @_;
my ($start_time, $intf, $group, $state, $ltime) =
- VyattaKeepalived::vrrp_state_parse($file);
+ Vyatta::Keepalived::vrrp_state_parse($file);
my ($interface_state, $link) = get_state_link($intf);
if ($state eq "master" || $state eq "backup" || $state eq "fault") {
my ($primary_addr, $priority, $preempt, $advert_int, $auth_type,
- @vips) = VyattaKeepalived::vrrp_get_config($intf, $group);
+ @vips) = Vyatta::Keepalived::vrrp_get_config($intf, $group);
my $format = "\n%-16s%-8s%-8s%-16s%-16s%-16s";
printf($format, $intf, $group, 'int', $primary_addr, $link, $state);
foreach my $vip (@vips){
@@ -192,12 +192,12 @@ sub vrrp_show {
my $now_time = time;
my ($start_time, $intf, $group, $state, $ltime) =
- VyattaKeepalived::vrrp_state_parse($file);
+ Vyatta::Keepalived::vrrp_state_parse($file);
my ($interface_state, $link) = get_state_link($intf);
my $first_vip = '';
if ($state eq "master" || $state eq "backup" || $state eq "fault") {
my ($primary_addr, $priority, $preempt, $advert_int, $auth_type,
- @vips) = VyattaKeepalived::vrrp_get_config($intf, $group);
+ @vips) = Vyatta::Keepalived::vrrp_get_config($intf, $group);
print "Physical interface: $intf, Address $primary_addr\n";
print " Interface state: $link, Group $group, State: $state\n";
print " Priority: $priority, Advertisement interval: $advert_int, ";
@@ -256,7 +256,7 @@ if ($#ARGV == 1) {
$group = $ARGV[1];
}
-if (!VyattaKeepalived::is_running()) {
+if (!Vyatta::Keepalived::is_running()) {
print "VRRP isn't running\n";
exit 1;
}
@@ -273,7 +273,7 @@ if ($showsummary == 1) {
$display_func = \&vrrp_show;
}
-my @state_files = VyattaKeepalived::get_state_files($intf, $group);
+my @state_files = Vyatta::Keepalived::get_state_files($intf, $group);
foreach my $state_file (@state_files) {
&$display_func($state_file);
}
diff --git a/scripts/keepalived/vyatta-vrrp-state.pl b/scripts/keepalived/vyatta-vrrp-state.pl
index a3be3095..930c7cd0 100755
--- a/scripts/keepalived/vyatta-vrrp-state.pl
+++ b/scripts/keepalived/vyatta-vrrp-state.pl
@@ -24,7 +24,7 @@
#
use lib "/opt/vyatta/share/perl5/";
-use VyattaKeepalived;
+use Vyatta::Keepalived;
use POSIX;
use strict;
@@ -35,7 +35,7 @@ sub vrrp_state_log {
my ($state, $intf, $group) = @_;
my $timestamp = strftime("%Y%m%d-%H:%M.%S", localtime);
- my $file = VyattaKeepalived::get_state_file($intf, $group);
+ my $file = Vyatta::Keepalived::get_state_file($intf, $group);
my $time = time();
my $line = "$time $intf $group $state $timestamp";
open my $fh, ">", $file;
@@ -52,22 +52,22 @@ foreach my $arg (4 .. $#ARGV) {
push @vrrp_vips, $ARGV[$arg];
}
-my $sfile = VyattaKeepalived::get_state_file($vrrp_intf, $vrrp_group);
+my $sfile = Vyatta::Keepalived::get_state_file($vrrp_intf, $vrrp_group);
my ($old_time, $old_intf, $old_group, $old_state, $old_ltime) =
- VyattaKeepalived::vrrp_state_parse($sfile);
+ Vyatta::Keepalived::vrrp_state_parse($sfile);
if (defined $old_state and $vrrp_state eq $old_state) {
#
# restarts call the transition script even if it really hasn't
# changed.
#
- VyattaKeepalived::vrrp_log("$vrrp_intf $vrrp_group same - $vrrp_state");
+ Vyatta::Keepalived::vrrp_log("$vrrp_intf $vrrp_group same - $vrrp_state");
exit 0;
}
-VyattaKeepalived::vrrp_log("$vrrp_intf $vrrp_group transition to $vrrp_state");
+Vyatta::Keepalived::vrrp_log("$vrrp_intf $vrrp_group transition to $vrrp_state");
vrrp_state_log($vrrp_state, $vrrp_intf, $vrrp_group);
if ($vrrp_state eq "backup") {
- VyattaKeepalived::snoop_for_master($vrrp_intf, $vrrp_group, $vrrp_vips[0],
+ Vyatta::Keepalived::snoop_for_master($vrrp_intf, $vrrp_group, $vrrp_vips[0],
60);
} elsif ($vrrp_state eq "master") {
#
@@ -83,7 +83,7 @@ if ($vrrp_state eq "backup") {
#
# remove the old master file since we are now master
#
- my $mfile = VyattaKeepalived::get_master_file($vrrp_intf, $vrrp_group);
+ my $mfile = Vyatta::Keepalived::get_master_file($vrrp_intf, $vrrp_group);
system("rm -f $mfile");
}