Commit cc7e1656 authored by Leigh B Stoller's avatar Leigh B Stoller

Fix to port allocation. Do not remove the experiment from the

ipport_ranges table during a swapmod, as this will cause the
ports to get reasigned or even worse, conflict with another
experiment.
parent 17a2cc8d
......@@ -159,7 +159,6 @@ $EXPT_RESOURCESHOSED = 0;
"virt_client_service_opts");
%physicalTables = ("delays" => ["node_id", "vname", "vnode0", "vnode1"],
"ipport_ranges" => undef,
"v2pmap" => ["node_id", "vname"],
"linkdelays" => ["node_id", "vlan", "vnode"],
"traces" => ["node_id", "idx"],
......@@ -4694,6 +4693,21 @@ sub GetPortRange($)
my ($low,$high) = $query_result->fetchrow_array();
return ($low, $high);
}
#
# This has to be done at swapout, but not during a swapmod since
# that would mess up the existing port assignments.
# So it is a special case, not in the physicalTables list.
#
sub ClearPortRange($)
{
my ($self) = @_;
my $idx = $self->idx();
DBQueryWarn("delete from ipport_ranges where exptidx=$idx")
or return -1;
return 0;
}
#
# Reserve all of the shared BW we need. The vinterfaces table has
......
......@@ -577,6 +577,10 @@ EmulabFeatures->DeleteAll($experiment) == 0 or
$experiment->ClearReservedVlanTags() == 0 or
fatal("Could not delete reserved vlan tags for $experiment");
# Just in case ...
$experiment->ClearPortRange() == 0 or
fatal("Could not delete ip port range for $experiment");
#
# Send email now, since once we call Delete() the log file is going
# to be unlinked.
......
......@@ -8552,9 +8552,11 @@ sub SetPortRange($)
my ($newlow,$newhigh) = $self->experiment()->GetPortRange();
if (!defined($newlow)) {
#
# It is okay to do this in impotent mode; it is harmless.
# We allocate a port range but do not save it. This is
# okay since we do not store the per-node assignments.
#
($newlow,$newhigh) = $self->experiment()->SetPortRange(0);
($newlow,$newhigh) =
$self->experiment()->SetPortRange($self->impotent());
}
if (!defined($newlow)) {
tberror("Could not set the portrange!\n");
......
......@@ -908,6 +908,7 @@ sub doSwapout($) {
$experiment->RemovePhysicalState(1);
# Special.
$experiment->ClearPortRegistration();
$experiment->ClearPortRange();
}
tblog_set_cleanup(0);
......
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