Commit f9a67648 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Fix up -o option (vlan delete) so that entries are properly removed

from the vlans table from tbswap. Also put back the test in nfree
that tests for vlan membership, now that snmpit is fixed.
parent 79046927
......@@ -200,7 +200,7 @@ if (! $moveToOldReserved) {
next
if ($node->isvirtnode() || $node->isremotenode());
if (0 && VLan->IsNodeInAVlan($node)) {
if (VLan->IsNodeInAVlan($node)) {
print STDERR "$node is still in a vlan!\n";
$error++;
}
......
......@@ -184,7 +184,9 @@ if ($UID) {
# the user didn't give any extraneous arguments
#
if ($opt{m} || $opt{o}) {
if (@ARGV < 2 || $ARGV[0] =~ /:/ || $ARGV[1] =~ /:/) {
if (@ARGV < 2 ||
($opt{m} && ($ARGV[0] =~ /:/ || $ARGV[1] =~ /:/)) ||
($opt{o} && ($ARGV[0] =~ /^\d+$/ || $ARGV[1] =~ /^\d+$/))) {
if (! $opt{f}) {
tberror "pid/eid reqired!";
exit(usage());
......@@ -1536,7 +1538,7 @@ sub doMakeVlan($$@) {
}
if (!$errors) {
if (defined($source_vlan)) {
VLan->RecordVLanDeletion($experiment, $source_vlan->id());
VLan->RecordVLanDeletion($source_vlan->id());
}
if (defined($target_vlan)) {
VLan->RecordVlanInsertion($experiment, $target_vlan->id());
......@@ -1625,15 +1627,21 @@ sub doDeleteVlan($@) {
}
}
foreach my $vlan_name (@vlan_names) {
my $vlan_id = $vlan_ids{$vlan_name};
#
# Skip if this was not deleted
#
next
if ($errors && exists($notdeleted{$vlan_name}));
# Always delete from the vlans table.
VLan->RecordVLanDeletion($vlan_id);
next
if (!exists($vlans{$vlan_name}));
my $vlan = $vlans{$vlan_name};
next
if ($errors && $notdeleted{$vlan_name});
VLan->RecordVLanDeletion($vlan->id());
$vlan->Destroy()
if ($vlan->IsManual());
}
......
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