Commit 4bf65a3f authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Insert the last mile type into the node_auxtypes table. The type/class

of all widearea nodes are now pcvwa/pcvwa, pcvron,pcvron, etc. The
last mile type (pcvroninet, pcwainet) comes from the aux types for the
node.
parent b2fd3333
...@@ -16,7 +16,7 @@ sub usage() ...@@ -16,7 +16,7 @@ sub usage()
"newwanode [-w] [-n nickname] -t <nodetype> -i <ip address>\n"; "newwanode [-w] [-n nickname] -t <nodetype> -i <ip address>\n";
exit(1); exit(1);
} }
my $optlist = "wt:i:v:n:"; my $optlist = "wt:i:a:n:";
# #
# Configure variables # Configure variables
...@@ -56,6 +56,7 @@ my $reuse = 0; ...@@ -56,6 +56,7 @@ my $reuse = 0;
my $nickname; my $nickname;
my $nodename; my $nodename;
my $nodevtype; my $nodevtype;
my $nodeauxtype;
my $nodevname; my $nodevname;
my $pid; my $pid;
my $eid; my $eid;
...@@ -79,8 +80,8 @@ if (defined($options{"i"})) { ...@@ -79,8 +80,8 @@ if (defined($options{"i"})) {
if (defined($options{"t"})) { if (defined($options{"t"})) {
$nodetype = $options{"t"}; $nodetype = $options{"t"};
} }
if (defined($options{"v"})) { if (defined($options{"a"})) {
$nodevtype = $options{"v"}; $nodeauxtype = $options{"a"};
} }
if (defined($options{"n"})) { if (defined($options{"n"})) {
$nickname = $options{"n"}; $nickname = $options{"n"};
...@@ -104,12 +105,12 @@ if ($nodeip =~ /^([\d\.]+)$/) { ...@@ -104,12 +105,12 @@ if ($nodeip =~ /^([\d\.]+)$/) {
else { else {
die("*** Bad data in $nodeip\n"); die("*** Bad data in $nodeip\n");
} }
if (defined($nodevtype)) { if (defined($nodeauxtype)) {
if ($nodevtype =~ /^([\w]+)$/) { if ($nodeauxtype =~ /^([\w]+)$/) {
$nodevtype = $1; $nodeauxtype = $1;
} }
else { else {
die("*** Bad data in $nodevtype\n"); die("*** Bad data in $nodeauxtype\n");
} }
} }
if (defined($nickname)) { if (defined($nickname)) {
...@@ -142,28 +143,19 @@ if ($nodetype ne "pcwa" && $nodetype ne "pcron") { ...@@ -142,28 +143,19 @@ if ($nodetype ne "pcwa" && $nodetype ne "pcron") {
} }
# #
# Make sure its a valid vtype too! # Create the virtual type name. Again, this is bogus.
# #
if (defined($nodevtype)) { if ($nodetype eq "pcwa") {
$query_result = $nodevtype = "pcvwa";
DBQueryFatal("select * from node_types where type='$nodevtype'"); $nodeauxtype = "pcvwainet"
if (!defined($nodeauxtype));
if (! $query_result->numrows) { }
fatal("*** $0:\n".
" No such nodevtype $nodevtype is defined in the DB!\n");
}
}
else { else {
# $nodevtype = "pcvron";
# Create the virtual type name. Again, this is bogus. $nodeauxtype = "pcvroninet"
# if (!defined($nodeauxtype));
if ($nodetype eq "pcwa") {
$nodevtype = "pcvwainet";
}
else {
$nodevtype = "pcvroninet";
}
} }
# #
# Again, this is bogus. # Again, this is bogus.
# #
...@@ -243,6 +235,10 @@ else { ...@@ -243,6 +235,10 @@ else {
" 'testnode', $nextpri, 'NORMAL', ". " 'testnode', $nextpri, 'NORMAL', ".
" '$defosid') "); " '$defosid') ");
DBQueryFatal("insert into node_auxtypes ".
"(node_id, type, count) ".
"values ('$nodename', '$nodeauxtype', 1)");
DBQueryFatal("replace into node_status ". DBQueryFatal("replace into node_status ".
"(node_id, status, status_timestamp) ". "(node_id, status, status_timestamp) ".
"values ('$nodename', 'down', now()) "); "values ('$nodename', 'down', now()) ");
...@@ -259,7 +255,6 @@ else { ...@@ -259,7 +255,6 @@ else {
DBQueryFatal("insert into reserved ". DBQueryFatal("insert into reserved ".
"(node_id, pid, eid, rsrv_time, vname) ". "(node_id, pid, eid, rsrv_time, vname) ".
"values ('$nodename', '$pid', '$eid', now(), '$nickname')"); "values ('$nodename', '$pid', '$eid', now(), '$nickname')");
} }
# #
...@@ -302,6 +297,7 @@ SENDMAIL($TBLOGS, $subject, ...@@ -302,6 +297,7 @@ SENDMAIL($TBLOGS, $subject,
"Name: $nodename\n". "Name: $nodename\n".
"IP: $nodeip\n". "IP: $nodeip\n".
"Vtype: $nodevtype\n". "Vtype: $nodevtype\n".
"Auxtype: $nodeauxtype\n".
"Vname: $nodevname (actually the last vnode)\n". "Vname: $nodevname (actually the last vnode)\n".
"Nickname: $nickname\n", "Nickname: $nickname\n",
$TBOPS); $TBOPS);
......
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