The vlan nicparam is used in openvswitch mode. This patch
exports it as VLAN environment variable so that NIC
configuration scripts can later use it.

Signed-off-by: Dimitris Aragiorgis <[email protected]>
Signed-off-by: Klaus Aehlig <[email protected]>
Reviewed-by: Klaus Aehlig <[email protected]>
---
 lib/hypervisor/hv_kvm.py |    3 +++
 lib/hypervisor/hv_xen.py |    1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 3476f7a..d331bd4 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -1081,6 +1081,9 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     if nic.nicparams[constants.NIC_LINK]:
       env["LINK"] = nic.nicparams[constants.NIC_LINK]
 
+    if nic.nicparams[constants.NIC_VLAN]:
+      env["VLAN"] = nic.nicparams[constants.NIC_VLAN]
+
     if nic.network:
       n = objects.Network.FromDict(nic.netinfo)
       env.update(n.HooksDict())
diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index a2b58da..85b1f59 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -458,6 +458,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
     data.write("INTERFACE_UUID=%s\n" % nic.uuid)
     data.write("MODE=%s\n" % nic.nicparams[constants.NIC_MODE])
     data.write("LINK=%s\n" % nic.nicparams[constants.NIC_LINK])
+    data.write("VLAN=%s\n" % nic.nicparams[constants.NIC_VLAN])
 
     try:
       utils.WriteFile(cfg_file, data=data.getvalue())
-- 
1.7.10.4

Reply via email to