Commit 3c2416f2 authored by Mike Hibler's avatar Mike Hibler

Make it work for elabinelab swapmod.

Apparently, on a swap modify, RemoteDeleteVlan gets called with an array
of vlan names rather than vlan objects. Needed to fix a couple of places
in the ELABINELAB path where this was not considered (the "regular" path
does handle this case).

While everything appears to work correctly now (i.e., inner DB state is
correct, outer vlans are set up correctly on switch), someone who knows
the code should double check this!
parent 8b49625f
......@@ -207,7 +207,7 @@ sub RemoteDoVlansFromTables($@)
my $vlan = $vlans{$vlanid};
#
# This is should always succeed since we do whatever the
# This should always succeed since we do whatever the
# outer emulab says to do.
#
if (! ($vlan->HasVlanTagReserved($tag) ||
......@@ -252,7 +252,8 @@ sub RemoteDeleteVlan($$)
my $vlan = shift();
my $cleartags = shift();
return RemoteDoReset(undef, 0, $cleartags, ($vlan->id()));
return RemoteDoReset(undef, 0, $cleartags,
(ref($vlan) ? $vlan->id() : $vlan));
}
#
......@@ -278,7 +279,7 @@ sub RemoteDoReset($$$@)
if ($response->{"code"});
foreach my $vlan (@vlans) {
clearReservedVlanTag($vlan)
VLan::ClearReservedVlanTag($vlan)
if ($cleartags);
VLan->RecordVLanDeletion($vlan);
}
......
......@@ -3466,7 +3466,7 @@ sub doDeleteVlan($@) {
if ($ELABINELAB) {
foreach my $vlan (values(%vlans)) {
if (RemoteDeleteVlan($vlan, $opt{C}) == 0) {
if ($vlan->Destroy() != 0) {
if (ref($vlan) && $vlan->Destroy() != 0) {
print STDERR "*** Could not destroy $vlan\n";
}
}
......
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