Commit b8a81a5d authored by Kirk Webb's avatar Kirk Webb

UE: Clear port forwarding setup when freeing the device.

parent fa587782
......@@ -76,6 +76,7 @@ my $nodereboot = "$TB/bin/node_reboot";
my $makeconf = "$TB/sbin/dhcpd_makeconf";
my $snmpit = "$TB/bin/snmpit";
my $dynmfssetup = "$TB/sbin/nfsmfs_setup";
my $tbadb = "$TB/bin/tbadb";
my $reloadpid = "emulab-ops";
my $pendingeid = "reloadpending";
my $rppendingeid = "repositionpending";
......@@ -568,7 +569,16 @@ foreach my $node (@freed_nodes) {
}
}
}
# If it's a UE, clear any existing ADB port forwarding setup.
if ($node->class() eq "ue") {
system("$tbadb -n $node_id unforward") == 0
or warn "Could not clear ADB forwarding on $node_id!";
}
###
# Now its safe to change the reservation.
###
# If the node has a next_reserve entry, change the reservation.
my $next_reservation = $node->NextReservation();
......
......@@ -492,8 +492,13 @@ sub cmd_unforward($@) {
my $node = Node->Lookup($node_id);
die "tbadb::cmd_unforward: Invalid node name $node_id!\n"
if (!defined($node));
# Fine to unforward if we are cleaning up inside of nfree.
my $experiment = $node->Reservation();
my $isholding = (defined($experiment)
&& $experiment->pid() eq NFREELOCKED_PID
&& $experiment->eid() eq NFREELOCKED_EID);
die("tbadb::cmd_unforward: You do not have permission to modify $node\n")
if (!$isroot && !$this_user->IsAdmin() &&
if (!$isroot && !$isholding &&
!$node->AccessCheck($this_user, TB_NODEACCESS_REBOOT));
# Grab the RPC pipe.
......@@ -522,7 +527,6 @@ sub cmd_unforward($@) {
}
# Clear the virt_node_attributes entry, if there is one.
my $experiment = $node->Reservation();
if ($experiment) {
my $pid = $experiment->pid();
my $eid = $experiment->eid();
......
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