summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-04-10 11:17:10 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2008-04-10 11:17:10 -0700
commit3458dfcee2b288c9edff6941e1739067b049fa60 (patch)
treef64e3fad0855125bf61a5210b7e18beac69be118
parent90bfb8446d408313e9c73335889629e10e616265 (diff)
downloadvyatta-cluster-3458dfcee2b288c9edff6941e1739067b049fa60.tar.gz
vyatta-cluster-3458dfcee2b288c9edff6941e1739067b049fa60.zip
fix for bug 3147: stop HA before changing HA config files.
-rw-r--r--scripts/VyattaClusterConfig.pm8
-rwxr-xr-xscripts/vyatta-update-cluster.pl9
2 files changed, 10 insertions, 7 deletions
diff --git a/scripts/VyattaClusterConfig.pm b/scripts/VyattaClusterConfig.pm
index a7ce914..ab5b536 100644
--- a/scripts/VyattaClusterConfig.pm
+++ b/scripts/VyattaClusterConfig.pm
@@ -163,12 +163,14 @@ EOS
}
sub check_interfaces {
- my @interfaces = @_;
+ my ($exist_only, @interfaces) = @_;
foreach (@interfaces) {
system("ip addr show $_ >& /dev/null");
if ($? >> 8) {
return "interface $_ does not exist";
}
+ next if ($exist_only);
+
my $link = `ip link show $_ | grep $_`;
if (($link =~ /NO-CARRIER/) || !($link =~ /,UP/)) {
return "interface $_ is not connected";
@@ -188,7 +190,7 @@ sub ha_cf {
return (undef, "using multiple resource groups is not supported yet")
if ($#groups > 0);
- my $ierr = check_interfaces(@{$self->{_interface}});
+ my $ierr = check_interfaces(0, @{$self->{_interface}});
if (defined($ierr)) {
return (undef, $ierr);
}
@@ -272,7 +274,7 @@ sub isValidIPSpec {
}
# check optional interface
if (defined($comps[2])) {
- return 0 if (defined(check_interfaces($comps[2])));
+ return 0 if (defined(check_interfaces(1, $comps[2])));
}
# check optional broadcast addr
if (defined($comps[3])) {
diff --git a/scripts/vyatta-update-cluster.pl b/scripts/vyatta-update-cluster.pl
index ada461f..5dcdc47 100755
--- a/scripts/vyatta-update-cluster.pl
+++ b/scripts/vyatta-update-cluster.pl
@@ -40,6 +40,11 @@ if ($ret >> 8) {
exit 1;
}
+# stop HA before changing config files
+print "Stopping clustering...";
+system("$HA_INIT stop >&/dev/null");
+print " Done\n";
+
if (!open(CONF_AUTH, ">$HA_DIR/authkeys")) {
print STDERR "Error: cannot create $HA_DIR/authkeys\n";
exit 1;
@@ -71,11 +76,7 @@ foreach (@init_services) {
system("$SERVICE_DIR/$_ stop");
}
-# restart clustering.
-# using "stop" + "start" ("restart" will cause a long wait).
-# (may need to change to "restart".)
print "Starting clustering...";
-system("$HA_INIT stop >&/dev/null");
system("$HA_INIT start >&/dev/null");
if ($? >> 8) {
print "\nError: Clustering failed to start.\n";