Commit 711d4cd1 authored by Leigh B Stoller's avatar Leigh B Stoller

Add trunk_mode to interfaces table since we need to worry

about dual vs equal trunking when doing experimental lans
on the control network.
parent 15d309bf
......@@ -1854,6 +1854,7 @@ CREATE TABLE `interfaces` (
`vnode_id` varchar(32) default NULL,
`whol` tinyint(4) NOT NULL default '0',
`trunk` tinyint(1) NOT NULL default '0',
`trunk_mode` enum('equal','dual') NOT NULL default 'equal',
`uuid` varchar(40) NOT NULL default '',
`logical` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`node_id`,`card`,`port`),
......
#
# Add trunk mode slot to interfaces table.
#
use strict;
use libdb;
use Lan;
my $impotent = 0;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("interfaces", "trunk_mode")) {
DBQueryFatal("alter table interfaces add ".
" `trunk_mode` enum('equal','dual') NOT NULL default 'equal' ".
" after trunk");
}
#
# Find all the current lan members with dual trunking.
#
my $query_result =
DBQueryFatal("select lanid,memberid from lan_member_attributes ".
"where attrkey='trunk_mode' and attrvalue='dual'");
while (my ($lanid,$memberid) = $query_result->fetchrow_array()) {
my $member = Lan::Member->Lookup($lanid, $memberid);
if (!defined($member)) {
print STDERR "*** Could not lookup lan member $lanid:$memberid\n";
return -1;
}
my $interface = $member->GetInterface();
if (!defined($interface)) {
print STDERR "*** Could not lookup interface for $member\n";
return -1;
}
if ($interface->Update({"trunk_mode" => "dual"})) {
print STDERR "*** Could not set dual trunk mode on $interface\n";
return -1;
}
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
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