Commit 3089f062 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Klaus Aehlig

KVM: fix NIC configuration with absent NIC VLAN

Commit 6b47261a exported the VLAN to the KVM NIC configuration scripts.
However, in doing so it assumed that the VLAN is always present in the
runtime, which is not true for instances being migrated but started on
Ganeti versions prior to 2.10.6.

We fix this by exporting the VLAN nicparam only if it actually exists.
This closes issue #893.
Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent c6199a4d
......@@ -1081,7 +1081,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if nic.nicparams[constants.NIC_LINK]:
env["LINK"] = nic.nicparams[constants.NIC_LINK]
if nic.nicparams[constants.NIC_VLAN]:
if constants.NIC_VLAN in nic.nicparams:
env["VLAN"] = nic.nicparams[constants.NIC_VLAN]
if nic.network:
......
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