Commit 3c62b29a authored by Leigh Stoller's avatar Leigh Stoller

Add per-node port ranges to the nodes table. Add code into newwanode

to assign the range when vnodes are created.
parent 62479b62
...@@ -25,6 +25,8 @@ my $TB = "@prefix@"; ...@@ -25,6 +25,8 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@"; my $TBOPS = "@TBOPSEMAIL@";
my $TBLOGS = "@TBLOGSEMAIL@"; my $TBLOGS = "@TBLOGSEMAIL@";
my $named_setup = "$TB/sbin/named_setup"; my $named_setup = "$TB/sbin/named_setup";
my $FIRSTIPPORT = 40000;
my $PERNODEPORTS= 256;
# un-taint path # un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin'; $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
...@@ -209,14 +211,19 @@ DBQueryFatal("insert into nodes ". ...@@ -209,14 +211,19 @@ DBQueryFatal("insert into nodes ".
for ($i = 1; $i < 9; $i++) { for ($i = 1; $i < 9; $i++) {
my $priority = ($nextpri * 100) + $i; my $priority = ($nextpri * 100) + $i;
$nodevname = "v${nodename}-${i}"; $nodevname = "v${nodename}-${i}";
# Per vnode ports.
my $portlow = $FIRSTIPPORT + (($i - 1) * $PERNODEPORTS);
my $porthigh = $portlow + $PERNODEPORTS - 1;
print "Creating widearea virtual node $nodevname ...\n"; print "Creating widearea virtual node $nodevname ...\n";
DBQueryFatal("insert into nodes ". DBQueryFatal("insert into nodes ".
"(node_id, type, phys_nodeid, role, priority, ". "(node_id, type, phys_nodeid, role, priority, ".
" status, op_mode, def_boot_osid, update_accounts) ". " status, op_mode, def_boot_osid, update_accounts, ".
" ipport_low, ipport_high) ".
"values ('$nodevname', '$nodevtype', '$nodename', ". "values ('$nodevname', '$nodevtype', '$nodename', ".
" 'virtnode', $priority, 'down', 'NORMAL', ". " 'virtnode', $priority, 'down', 'NORMAL', ".
" '$defosid', 1) "); " '$defosid', 1, $portlow, $porthigh) ");
} }
DBQueryFatal("insert into interfaces ". DBQueryFatal("insert into interfaces ".
......
...@@ -295,6 +295,11 @@ foreach my $n (@freed_nodes) { ...@@ -295,6 +295,11 @@ foreach my $n (@freed_nodes) {
# #
DBQueryWarn("delete from current_reloads where node_id='$n'") || $error++; DBQueryWarn("delete from current_reloads where node_id='$n'") || $error++;
#
# Reset its port allocation stuff.
#
DBQueryWarn("delete from nodeipportnum where node_id='$n'") || $error++;
# #
# Now its safe to change the reservation. # Now its safe to change the reservation.
# #
......
...@@ -564,6 +564,8 @@ CREATE TABLE nodes ( ...@@ -564,6 +564,8 @@ CREATE TABLE nodes (
ipodhash varchar(64) default NULL, ipodhash varchar(64) default NULL,
osid varchar(35) NOT NULL default '', osid varchar(35) NOT NULL default '',
ntpdrift float default NULL, ntpdrift float default NULL,
ipport_low int(11) NOT NULL default '11000',
ipport_high int(11) NOT NULL default '20000',
PRIMARY KEY (node_id) PRIMARY KEY (node_id)
) TYPE=MyISAM; ) TYPE=MyISAM;
......
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