Commit 2b067fec authored by Mike Hibler's avatar Mike Hibler
Browse files

Ick. Add a retry loop for getting ifconfig info from TMCD.

This is needed for multiplexed links which use tagged VLANs as their
implementation.  For these links, it is possible at initial swapin time
that the VLAN tag has not been setup in the DB by the time we query it.
So if we get back a 0 tag, we sleep awhile and try again.
parent c70d0342
......@@ -115,9 +115,7 @@ sub doboot()
# Get the iface list from libsetup, which handles parsing the stuff
# we get back from tmcd.
if (getifconfig(\@ifacelist) != 0) {
fatal("Could not get ifconfig from libsetup!");
return 0
if (! @ifacelist);
......@@ -301,3 +299,56 @@ sub docleanup()
unlink $TMIFC;
unlink $TMIFMAP;
# Total ICK!
# We may have to retry the getifconfig call if the experiment involves
# "vlan" devices. Since the VLAN tag (number) comes from the switch,
# and switch setup happens in parallel with us, it is possible that some
# VLANs may not yet be assigned. So we keep calling getifconfig until
# we have tags for all such interfaces.
sub mygetifconfig($)
my ($listref) = @_;
# How long it takes can be proportional to the number of VLANs that
# have to be setup--could be seconds, could be minutes. Arbitrarily
# pick 10 minutes. In the long run, it probably doesn't matter because
# the higher level node setup timeout is likely to trigger at around
# 8-10 minutes, rebooting us anyway.
my $maxtries = 40;
my $sleeptime = 15;
my @ifacelist = ();
if (getifconfig(\@ifacelist) != 0) {
fatal("Could not get ifconfig from libsetup!");
for (my $tries = 0; $tries < $maxtries; $tries++) {
my $bad = 0;
foreach my $ifconfig (@ifacelist) {
if ($ifconfig->{ISVIRT} &&
$ifconfig->{ITYPE} eq "vlan" && $ifconfig->{VTAG} == 0) {
if (!$bad) {
@$listref = @ifacelist;
warning("$bad vlan devices do not yet have tags, trying again...");
@ifacelist = ();
if (getifconfig(\@ifacelist, 1) != 0) {
fatal("Could not re-get ifconfig from libsetup!");
fatal("Could not get all VLAN tags after $maxtries tries");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment