Commit 0347a665 authored by Leigh B Stoller's avatar Leigh B Stoller

Fix for setting port numbers.

parent c457235e
...@@ -4651,6 +4651,7 @@ sub AllocNodes($) ...@@ -4651,6 +4651,7 @@ sub AllocNodes($)
# For assigning dynamic ports. # For assigning dynamic ports.
$pnode->_portarray(undef); $pnode->_portarray(undef);
$pnode->_portlow(TBDB_LOWVPORT); $pnode->_portlow(TBDB_LOWVPORT);
$pnode->_portnext(TBDB_LOWVPORT);
$pnode->_porthigh(TBDB_MAXVPORT); $pnode->_porthigh(TBDB_MAXVPORT);
# To avoid unitialized access. # To avoid unitialized access.
$pnode->_reuse("used"); $pnode->_reuse("used");
...@@ -7452,10 +7453,9 @@ sub array_diff($$) ...@@ -7452,10 +7453,9 @@ sub array_diff($$)
sub SetPortRange($) sub SetPortRange($)
{ {
my ($self) = @_; my ($self) = @_;
# #
# See if any virtual nodes. If not, no need to do anything since # No virtual nodes, fall back to simple approach.
# all port allocations will come from the physical node.
# #
return 0 return 0
if (! scalar(keys(%{ $self->solution_v2v() }))); if (! scalar(keys(%{ $self->solution_v2v() })));
...@@ -7534,13 +7534,22 @@ sub SetPortRange($) ...@@ -7534,13 +7534,22 @@ sub SetPortRange($)
# #
# Bump and return the IP port number for a node. This is # Bump and return the IP port number for a node. This is
# required for multiplexing virtual nodes on a physical node. # required for multiplexing virtual nodes on a physical node.
# #
sub nextipportnum($) sub nextipportnum($)
{ {
my ($pnode, $default) = @_; my ($pnode, $default) = @_;
my $portarray = $pnode->_portarray(); my $portarray = $pnode->_portarray();
my $port = 0; my $port = 0;
if (!defined($portarray)) {
#
# Fall back to simple approach; no shared nodes.
#
$port = $pnode->_portnext();
$pnode->_portnext($port + 2);
return $port;
}
for (my $i = 0; $i < $pnode->_porthigh() - $pnode->_portlow(); $i++) { for (my $i = 0; $i < $pnode->_porthigh() - $pnode->_portlow(); $i++) {
if ($portarray->[$i] < 0) { if ($portarray->[$i] < 0) {
$port = 0 - $portarray->[$i]; $port = 0 - $portarray->[$i];
......
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