Commit 5ce6fa9a authored by Sebastian Gebhard's avatar Sebastian Gebhard Committed by Michele Tartara
Browse files

Fix KeyErrors with network mode and vlan

This patch fixes some KeyErrors that were introduced by the vlan implementation
and showed up when certain parameters were missing:
gnt-cluster init without network mode
gnt-isntance add without vlan
Signed-off-by: default avatarSebastian Gebhard <>
Signed-off-by: default avatarMichele Tartara <>
Reviewed-by: default avatarMichele Tartara <>
parent 27eb699d
......@@ -121,10 +121,11 @@ def InitCluster(opts, args):
master_netdev = opts.master_netdev
if master_netdev is None:
if not opts.nicparams[constants.NIC_MODE]:
nic_mode = opts.nicparams.get(constants.NIC_MODE, None)
if not nic_mode:
# default case, use bridging
master_netdev = constants.DEFAULT_BRIDGE
elif opts.nicparams[constants.NIC_MODE] == constants.NIC_MODE_OVS:
elif nic_mode == constants.NIC_MODE_OVS:
# default ovs is different from default bridge
master_netdev = constants.DEFAULT_OVS
opts.nicparams[constants.NIC_LINK] = constants.DEFAULT_OVS
......@@ -391,8 +391,8 @@ class LUInstanceCreate(LogicalUnit):
for nic in self.op.nics:
if nic[constants.INIC_VLAN]:
vlan = nic[constants.INIC_VLAN]
vlan = nic.get(constants.INIC_VLAN, None)
if vlan:
if vlan[0] == ".":
# vlan starting with dot means single untagged vlan,
# might be followed by trunk (:)
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