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 objects.NodeGroup.UpgradeConfig(). Signed-off-by: Dimitris Aragiorgis <[email protected]> --- lib/cmdlib/network.py | 3 +++ lib/objects.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/cmdlib/network.py b/lib/cmdlib/network.py index 5dc8771..4cf4a43 100644 --- a/lib/cmdlib/network.py +++ b/lib/cmdlib/network.py @@ -571,6 +571,7 @@ class LUNetworkConnect(LogicalUnit): self.group_name = self.op.group_name self.network_mode = self.op.network_mode self.network_link = self.op.network_link + self.network_vlan = "" self.network_uuid = self.cfg.LookupNetwork(self.network_name) self.group_uuid = self.cfg.LookupNodeGroup(self.group_name) @@ -621,7 +622,9 @@ class LUNetworkConnect(LogicalUnit): self.netparams = { constants.NIC_MODE: self.network_mode, constants.NIC_LINK: self.network_link, + constants.NIC_VLAN: self.network_vlan, } + objects.NIC.CheckParameterSyntax(self.netparams) self.group = self.cfg.GetNodeGroup(self.group_uuid) diff --git a/lib/objects.py b/lib/objects.py index 93117f0..5d98513 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -1521,6 +1521,9 @@ class NodeGroup(TaggableObject): if self.networks is None: self.networks = {} + for network, netparams in self.networks.items(): + self.networks[network] = FillDict(constants.NICC_DEFAULTS, netparams) + def FillND(self, node): """Return filled out ndparams for L{objects.Node} -- 1.7.10.4
