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

Change to use control_iface instead of control_net.

When inserting new interface entries, set the role appropriately,
based on control_iface setting in the node_types table.
parent dfef599c
...@@ -123,13 +123,13 @@ NODE: foreach my $node_id (@node_ids) { ...@@ -123,13 +123,13 @@ NODE: foreach my $node_id (@node_ids) {
# Make sure that the new node is of a valid type, and grab a few other # Make sure that the new node is of a valid type, and grab a few other
# things to fill in as initial values # things to fill in as initial values
# #
$query_result = DBQueryFatal("SELECT control_net FROM node_types " . $query_result = DBQueryFatal("SELECT control_iface FROM node_types " .
"WHERE type='$type'"); "WHERE type='$type'");
if (!$query_result->num_rows()) { if (!$query_result->num_rows()) {
warn "Node $node_id failed: Type $type does not exist!\n"; warn "Node $node_id failed: Type $type does not exist!\n";
next NODE; next NODE;
} }
my ($control_net) = $query_result->fetchrow(); my ($control_iface) = $query_result->fetchrow();
# #
# Grab the node's MACs from the new_interfaces table # Grab the node's MACs from the new_interfaces table
...@@ -218,14 +218,16 @@ NODE: foreach my $node_id (@node_ids) { ...@@ -218,14 +218,16 @@ NODE: foreach my $node_id (@node_ids) {
my $iface = "eth$card"; my $iface = "eth$card";
my $iface_IP = ""; my $iface_IP = "";
my $wire_type = "Node"; my $wire_type = "Node";
if ($card == $control_net) { my $iface_role = TBDB_IFACEROLE_EXPERIMENT();
if ($iface == $control_iface) {
$iface_IP = $IP; $iface_IP = $IP;
$wire_type = "Control"; $wire_type = "Control";
$iface_role = TBDB_IFACEROLE_CONTROL();
} }
DBQueryFatal("INSERT INTO interfaces SET node_id='$node_id', " . DBQueryFatal("INSERT INTO interfaces SET node_id='$node_id', " .
"card=$card, port=1, mac='$MAC', IP='$iface_IP', " . "card=$card, port=1, mac='$MAC', IP='$iface_IP', " .
"interface_type='$iface_type', iface='$iface', " . "interface_type='$iface_type', iface='$iface', " .
"current_speed='$speed', duplex=$duplex"); "current_speed='$speed', duplex=$duplex, role='$iface_role'");
if (!$switch_id) { if (!$switch_id) {
print "No switch found for ${node_id}:$iface - skipping\n"; print "No switch found for ${node_id}:$iface - skipping\n";
......
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