From 90bfb8446d408313e9c73335889629e10e616265 Mon Sep 17 00:00:00 2001 From: An-Cheng Huang Date: Mon, 7 Apr 2008 15:06:40 -0700 Subject: fix for bugs 2970, 3109, 3110: * replace output messages. * add interface checks. --- scripts/VyattaClusterConfig.pm | 8 ++++++++ scripts/vyatta-update-cluster.pl | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/VyattaClusterConfig.pm b/scripts/VyattaClusterConfig.pm index 08c31de..a7ce914 100644 --- a/scripts/VyattaClusterConfig.pm +++ b/scripts/VyattaClusterConfig.pm @@ -169,6 +169,14 @@ sub check_interfaces { if ($? >> 8) { return "interface $_ does not exist"; } + my $link = `ip link show $_ | grep $_`; + if (($link =~ /NO-CARRIER/) || !($link =~ /,UP/)) { + return "interface $_ is not connected"; + } + system("ip addr show dev $_ |grep 'inet ' |grep -q 'scope global'"); + if ($? >> 8) { + return "interface $_ is not configured"; + } } return undef; } diff --git a/scripts/vyatta-update-cluster.pl b/scripts/vyatta-update-cluster.pl index 56545e5..ada461f 100755 --- a/scripts/vyatta-update-cluster.pl +++ b/scripts/vyatta-update-cluster.pl @@ -74,8 +74,15 @@ foreach (@init_services) { # restart clustering. # using "stop" + "start" ("restart" will cause a long wait). # (may need to change to "restart".) -system("$HA_INIT stop"); -system("$HA_INIT start"); - +print "Starting clustering..."; +system("$HA_INIT stop >&/dev/null"); +system("$HA_INIT start >&/dev/null"); +if ($? >> 8) { + print "\nError: Clustering failed to start.\n"; + print "Please make sure all clustering interfaces are functional\n"; + print "and retry the commit.\n"; + exit 1; +} +print " Done\n"; exit 0; -- cgit v1.2.3