Skip to content

Commit

Permalink
vyatta-cluster: wait for link up on clustering for up to 10 seconds
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexharpin committed Mar 8, 2015
1 parent 82318d5 commit c0b623c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Vyatta/Cluster/Config.pm
Expand Up @@ -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";
Expand Down

0 comments on commit c0b623c

Please sign in to comment.