Commit 24acc12d authored by Leigh Stoller's avatar Leigh Stoller

Fix bitrot in genirack wires table insertion.

parent 5feec976
#!/usr/bin/perl -wT
#
# Copyright (c) 2011-2017 University of Utah and the Flux Group.
# Copyright (c) 2011-2017, 2019 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -587,17 +587,25 @@ sub CommitWire
my $result = ResolveRow($id);
while (my ($skip, $cable, $len, $type, $node_id1, $card1, $port1,
$node_id2, $card2, $port2) = $result->fetchrow()) {
my $interface1 = Interface->Lookup($node_id1, $card1, $port1);
my $iface1 = "eth${card1}";
my $iface2 = "${card2}/${port2}";
my $interface1 = Interface->LookupByIface($node_id1, $iface1);
if (!defined($interface1)) {
$errors{"command"} = "Cannot lookup interface1";
return;
}
my $interface2 = Interface->Lookup($node_id2, $card2, $port2);
my $interface2 = Interface->LookupByIface($node_id2, $iface2);
if (!defined($interface2)) {
$errors{"command"} = "Cannot lookup interface2";
return;
}
my $wireargs = {};
my $wireargs = {
"card1" => $card1,
"port1" => $port1,
"card2" => $card2,
"port2" => $port2,
};
$wireargs->{"cable"} = $cable if (defined($cable));
$wireargs->{"length"} = $len if (defined($len));
if ($fake) {
......
......@@ -9,6 +9,7 @@ use lib "@prefix@/lib";
use User;
my $TB = "@prefix@";
my $ADDINTERFACE = "$TB/sbin/addinterface";
my $NEWSCRIPT = "$TB/bin/newscript";
my $controliloip;
......@@ -215,6 +216,8 @@ foreach my $current (@wires) {
} elsif ($role eq "mngmnt") {
$type = "Management";
}
system("$ADDINTERFACE -b 1Gb $switch '${switch_card}/${switch_port}'");
my $file = "$outpath/wire.$node_id.$card.$port";
open(WIRE_FILE, ">$file");
print WIRE_FILE "<newwire>\n";
......
......@@ -118,7 +118,7 @@
<port1>1</port1>
<node_id2>procurve1</node_id2>
<card2>1</card2>
<port2>6</port2>
<port2>5</port2>
</wire>
<wire>
<UXX>U07</UXX>
......
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