Commit 5f942a73 authored by Leigh B. Stoller's avatar Leigh B. Stoller

A few more ELABINELAB related changes. The ordering of interfaces

might different, as reported by the newnode MFS. At present, I need
the ordering (and thus, the iface names) to agree with the outer
emulab since that is how I request vlans to be setup. This is not
very pleasing, and I will probably have to change it to use MACs
instead. For now, reorder the new_interfaces based on what switchmac
(the proxy) tells us.
parent 30667bc5
......@@ -50,15 +50,15 @@ function find_switch_macs(&$mac_list) {
if ($ELABINELAB) {
# We let switchmac tell us.
$mac_list[$MAC]["class"] = $class;
# Need this to reorder the interfaces.
$mac_list[$MAC]["iface"] = $iface;
}
}
$line = fgets($macs);
}
pclose($macs);
return 1;
# Return exit status to caller!
return pclose($macs);
}
function guess_node_type($proc,$disk) {
......
......@@ -143,7 +143,44 @@ if ($research) {
}
echo "<h3>Looking for MACs, this could take a while...</h3>";
find_switch_macs($mac_list);
$retval = find_switch_macs($mac_list);
if ($ELABINELAB && $retval == 0) {
#
# Ick, Ick, Ick. Must reorder the interfaces so that they are
# the same as the outside Emulab, so that when we request the
# outer emulab to create a vlan, both are talking about the same
# interface. This is of course, bogus. I think I will have to
# change it so that we use the MACs instead of the iface name.
# That should be an easy change to snmpit_remote and the xmlrpc
# server stub (or the proxy I guess).
#
# Move them out of the way
#
foreach ($mac_list as $mac => $switchport) {
DBQueryFatal("update new_interfaces set card = card + 100 " .
"where new_node_id='$switchport[new_node_id]' and " .
" card=$switchport[card]");
}
#
# Now move them back to proper location, as specifed by the iface
# that the outer emulab return to us.
#
foreach ($mac_list as $mac => $switchport) {
$iface = $switchport["iface"];
if (preg_match("/^(.*\D)(\d+)$/", $iface, $matches)) {
$newcard = $matches[2];
$oldcard = $switchport["card"] + 100;
DBQueryFatal("update new_interfaces set card = $newcard " .
"where new_node_id='$switchport[new_node_id]' " .
" and card=$oldcard");
# Remember, $switchport is a *copy*, so must change $mac_list
$mac_list[$mac]["card"] = $newcard;
}
}
}
foreach ($mac_list as $mac => $switchport) {
if ($switchport["switch"]) {
$extra_set = "";
......
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