summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-03-08 09:25:01 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-03-08 09:25:01 +0000
commitc0b623c22ec5223ebc39f5483339c88311f8afec (patch)
tree772a96cffcfdaea233f023a16396b1031ff9019d
parent82318d52f09c9da52600aa3dce6e4af768ae624c (diff)
downloadvyatta-cluster-c0b623c22ec5223ebc39f5483339c88311f8afec.tar.gz
vyatta-cluster-c0b623c22ec5223ebc39f5483339c88311f8afec.zip
vyatta-cluster: wait for link up on clustering for up to 10 seconds
If the interfaces involved in a cluster are slow to either gain carrier or show as link up during boot, the cluster configuration will fail to load. Add a delay of up to 10 seconds for this to occur, retesting every second for a change in carrier / link status. Bug #243 http://bugzilla.vyos.net/show_bug.cgi?id=243
-rw-r--r--lib/Vyatta/Cluster/Config.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Vyatta/Cluster/Config.pm b/lib/Vyatta/Cluster/Config.pm
index f6b692a..2c005f2 100644
--- a/lib/Vyatta/Cluster/Config.pm
+++ b/lib/Vyatta/Cluster/Config.pm
@@ -174,9 +174,17 @@ sub check_interfaces {
next if ($exist_only);
my $link = `ip link show $_ | grep $_`;
- if (($link =~ /NO-CARRIER/) || !($link =~ /,UP/)) {
- return "interface $_ is not connected";
+ my $link_test = 0;
+
+ while (($link =~ /NO-CARRIER/) || !($link =~ /,UP/)) {
+ $link_test++;
+ sleep(1);
+ $link = `ip link show $_ | grep $_`;
+ if ($link_test >= 10) {
+ return "interface $_ is not connected";
+ }
}
+
system("ip addr show dev $_ |grep 'inet ' |grep -q 'scope global'");
if ($? >> 8) {
return "interface $_ is not configured";