Commit a31ae886 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Bug fix for fixing VMs to nodes. Changes to shared vlans.

People try to fix pc433 to pc433. The former is a node in the topo,
the later is a physical node. Causes confusion, breaks. Look for
this corner case.

Allow lans that use shared lans, to have more then one port. So now
you can do this in your rspec:

   <link client_id="link0">
     <vlan:link_shared_vlan name="openflow-mesoscale" />
     <interface_ref client_id="node1:if" />
     <interface_ref client_id="node2:if" />
   </link>
parent bee73f22
......@@ -1364,19 +1364,24 @@ sub LoadVirtNodes($)
next
if (! ($vnode->_isvirtnode() && $vnode->_fixedvm()));
my $fixnode = $self->vnodes()->{$vnode->_fixedvm()};
#
# If the node is fixed to a physical node, skip. This is a
# plain old fixnode operation, not our new support for fixing
# a VM to a real node in the topology.
#
if (!defined($fixnode)) {
# It is silly to fix a node to yourself, so what this probably
# means is that the user really wants to fix to a physical node
# of the same name.
#
if (!defined($fixnode) || $vnode->_fixedvm() eq $vname) {
# Lets make sure its a real node.
my $fixvname = $vnode->_fixedvm();
if (!defined(Node->Lookup($fixvname))) {
tberror("Cannot fix $vnode to $fixvname; No such node\n");
tberror("Cannot fix $vnode to $fixvname; No such phys node\n");
return -1;
}
$vnode->_fixedvm(undef);
......@@ -1569,6 +1574,25 @@ sub LoadVirtLans($)
$virtlan->_delayed(0);
$vlanmember->_bridged(0);
#
# Look for a sharedvlan setting, which is the name of the
# shared vlan that this lan wants its ports put into.
#
$virtlan->_portvlan(undef);
foreach my $lan_setting ($self->virt_lan_settings()->Rows()) {
next
if ($vlanname ne $lan_setting->vname());
my $capkey = $lan_setting->capkey();
my $capval = $lan_setting->capval();
if ($capkey eq "sharedvlan" || $capkey eq "portvlan") {
$virtlan->_portvlan($capval);
last;
}
}
#
# XXX - Whenever a delay node is inserted, port speeds are set to
# the next fastest interface type we have, even if they requested
......@@ -2655,37 +2679,14 @@ sub GenVirtLans($)
next;
}
}
elsif (@members == 1) {
elsif (defined($vlan->_portvlan())) {
#
# Special case that we use to connect a port to a vlan
# in another experiment. There is no delay or other stuff.
#
my $member = $members[0];
my $lannode = "portlan/$vname";
my $virtnode = $member->virt_node();
my $vnodevname = $virtnode->vname();
my $porttoken;
#
# Need to map the name of the lan we want to join, to
# a real vlan object.
#
foreach my $lan_setting ($self->virt_lan_settings()->Rows()) {
next
if ($vname ne $lan_setting->vname());
my $capkey = $lan_setting->capkey();
my $capval = $lan_setting->capval();
if ($capkey eq "portvlan") {
$porttoken = $capval;
last;
}
}
if (!defined($porttoken)) {
tberror("No target vlan for $vname!\n");
return -1;
}
my $porttoken = $vlan->_portvlan();
my $lannode = "portlan/$vname";
#
# Map the token.
#
......@@ -2704,6 +2705,7 @@ sub GenVirtLans($)
tberror("Target vlan for $porttoken is not open!\n");
return -1;
}
# Convert to actual object for later
$vlan->_portvlan($portvlan);
# Lan node for assign.
......@@ -2713,15 +2715,19 @@ sub GenVirtLans($)
# So we ignore it when it comes back from assign.
$self->lannodes()->{$lannode} = 1;
my $others = {};
my $plink = "portlan/$vname/$member";
foreach my $member (@members) {
my $virtnode = $member->virt_node();
my $vnodevname = $virtnode->vname();
my $others = {};
my $plink = "portlan/$vname/$member";
$self->createLink($vname, $plink,
[$virtnode->_cmurn()],
{'virtual_node_id' => $vnodevname,
'virtual_interface_id' =>"$member" },
{'virtual_node_id' => $lannode },
'*', $protocol, $others);
$self->createLink($vname, $plink,
[$virtnode->_cmurn()],
{'virtual_node_id' => $vnodevname,
'virtual_interface_id' =>"$member" },
{'virtual_node_id' => $lannode },
'*', $protocol, $others);
}
}
elsif (@members == 2 && !$vlan->_bridged()) {
#
......
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