Commit 4bf65a3f authored by Leigh Stoller's avatar Leigh Stoller

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