From 760570a8ae286c3b46add2074aa9323e93f3a509 Mon Sep 17 00:00:00 2001
From: Timothy Kuhlman <timkuhlman@gmail.com>
Date: Mon, 8 Mar 2010 15:43:40 +0000
Subject: [PATCH] KVM: Fix unintended qemu-level bridging of nics

Each nic should be connected to its own qemu vlan, to avoid them all
bridging together.

Signed-off-by: Timothy Kuhlman <timkuhlman@gmail.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/hypervisor/hv_kvm.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 03b244802..db733d6a2 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -507,10 +507,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
         nic_model = "model=%s" % nic_type
 
       for nic_seq, nic in enumerate(kvm_nics):
-        nic_val = "nic,macaddr=%s,%s" % (nic.mac, nic_model)
+        nic_val = "nic,vlan=%s,macaddr=%s,%s" % (nic_seq, nic.mac, nic_model)
         script = self._WriteNetScript(instance, nic_seq, nic)
         kvm_cmd.extend(['-net', nic_val])
-        kvm_cmd.extend(['-net', 'tap,script=%s' % script])
+        kvm_cmd.extend(['-net', 'tap,vlan=%s,script=%s' % (nic_seq, script)])
         temp_files.append(script)
 
     if incoming:
-- 
GitLab