Commit e53ef585 authored by Mike Hibler's avatar Mike Hibler

Allow a new node to self-report its cnet interface.

This is useful for the new r430s where the control net location varies
depending on how many 1Gb experimental interfaces the node has.
parent d776153b
<?PHP
#
# Copyright (c) 2003-2013 University of Utah and the Flux Group.
# Copyright (c) 2003-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -189,7 +189,7 @@ $row = mysql_fetch_array($query_result)
$query_result = DBQueryFatal("SELECT card, mac, interface_type, switch_id, " .
"switch_card, switch_port, cable, len FROM new_interfaces " .
"where new_node_id=$id");
"where new_node_id=$id order by card");
while ($row = mysql_fetch_array($query_result)) {
$card = $row['card'];
$mac = $row['mac'];
......
<?php
#
# Copyright (c) 2003-2014 University of Utah and the Flux Group.
# Copyright (c) 2003-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -43,7 +43,8 @@ $reqargs = RequiredPageArguments("cpuspeed", PAGEARG_STRING,
$optargs = OptionalPageArguments("node_id", PAGEARG_STRING,
"identifier", PAGEARG_STRING,
"use_temp_IP", PAGEARG_STRING,
"type", PAGEARG_STRING);
"type", PAGEARG_STRING,
"cnetiface", PAGEARG_STRING);
#
# Grab the IP address that this node has right now, so that we can contact it
......@@ -65,6 +66,9 @@ foreach ($_GET as $key => $value) {
$interfaces[$ifacenum]["type"] = $matches[1];
}
$interfaces[$ifacenum]["card"] = $ifacenum;
if (isset($cnetiface) && $cnetiface == $value) {
$cnetcard = $ifacenum;
}
} else {
echo "Bad interface name ". CleanString($value). ", ignored!";
$interfaces[$ifacenum]["bad"] = 1;
......@@ -92,6 +96,9 @@ foreach ($_GET as $key => $value) {
# weed out bad ones
foreach ($interfaces as $i => $interface) {
if (isset($interface["bad"])) {
if (isset($cnetcard) && $cnetcard == $interface["card"]) {
unset($cnetcard);
}
unset($interfaces[$i]);
}
}
......@@ -225,10 +232,14 @@ foreach ($interfaces as $interface) {
$mac = $interface["mac"];
$type = $interface["type"];
$clause = "";
# see if they specified the cnet interface and this is it
if (isset($cnetcard) && $cnetcard == $card) {
$clause .= ", role='ctrl'";
}
# XXX not a 6 byte value, assume it is a guid
# XXX probably should check interface_capabilities for the type
if (strlen($mac) != 12) {
$clause = ", guid='$mac'";
$clause .= ", guid='$mac'";
# XXX 16 bytes implies an Infiniband port GUID to us
# cons up what would be the mac
if (strlen($mac) == 16) {
......
<?PHP
#
# Copyright (c) 2003-2013 University of Utah and the Flux Group.
# Copyright (c) 2003-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -410,8 +410,12 @@ while ($row = mysql_fetch_array($nodes_result)) {
while ($irow = mysql_fetch_array($ifaces_result)) {
$card = $irow["card"];
$iface = "eth${card}";
$role = $irow["role"];
if (!isset($role)) {
$role = "";
}
if ($iface == $control_iface) {
if ($role == TBDB_IFACEROLE_CONTROL || $iface == $control_iface) {
$mac = $irow["mac"];
if ($irow["switch_id"]) {
......@@ -424,7 +428,11 @@ while ($row = mysql_fetch_array($nodes_result)) {
else {
$port = "unknown";
}
break;
# new_interfaces role is definitive, else keep looking
if ($role == TBDB_IFACEROLE_CONTROL) {
break;
}
}
}
......
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