Commit 148c7ee0 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Klaus Aehlig
Browse files

Fix LUNetworkConnect wrt vlan

A network is currently connected to a nodegroup with a mode and a
link. Those netparams are inherited as nicparams when a NIC is
attached to a network and filled with the cluster wide defaults.

Since vlan was added to NIC parameters, netparams should be updated
to include it too otherwise NICs attached to a network can be found
with mode=bridged, link=some bridge and the cluster wide vlan.

This patch fixes LUNetworkConnect to add an empty string vlan to
netparams along with the user provided mode and link. Additionally
it adds an empty vlan to existing netparams via
Signed-off-by: default avatarDimitris Aragiorgis <>
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 1238fc4d
...@@ -571,6 +571,7 @@ class LUNetworkConnect(LogicalUnit): ...@@ -571,6 +571,7 @@ class LUNetworkConnect(LogicalUnit):
self.group_name = self.op.group_name self.group_name = self.op.group_name
self.network_mode = self.op.network_mode self.network_mode = self.op.network_mode
self.network_link = self.op.network_link self.network_link = self.op.network_link
self.network_vlan = ""
self.network_uuid = self.cfg.LookupNetwork(self.network_name) self.network_uuid = self.cfg.LookupNetwork(self.network_name)
self.group_uuid = self.cfg.LookupNodeGroup(self.group_name) self.group_uuid = self.cfg.LookupNodeGroup(self.group_name)
...@@ -621,7 +622,9 @@ class LUNetworkConnect(LogicalUnit): ...@@ -621,7 +622,9 @@ class LUNetworkConnect(LogicalUnit):
self.netparams = { self.netparams = {
constants.NIC_MODE: self.network_mode, constants.NIC_MODE: self.network_mode,
constants.NIC_LINK: self.network_link, constants.NIC_LINK: self.network_link,
constants.NIC_VLAN: self.network_vlan,
} }
objects.NIC.CheckParameterSyntax(self.netparams) objects.NIC.CheckParameterSyntax(self.netparams) = self.cfg.GetNodeGroup(self.group_uuid) = self.cfg.GetNodeGroup(self.group_uuid)
...@@ -1521,6 +1521,9 @@ class NodeGroup(TaggableObject): ...@@ -1521,6 +1521,9 @@ class NodeGroup(TaggableObject):
if self.networks is None: if self.networks is None:
self.networks = {} self.networks = {}
for network, netparams in self.networks.items():
self.networks[network] = FillDict(constants.NICC_DEFAULTS, netparams)
def FillND(self, node): def FillND(self, node):
"""Return filled out ndparams for L{objects.Node} """Return filled out ndparams for L{objects.Node}
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