I have an instance with two networks. The node I am running on has two
bridges one for each network. When I would power up the instance I ran
into some spanning tree issues. For some reason the two tap interfaces
were bridging.
Doing a ps the kvm command had this in it for the nics.
-net nic,macaddr=aa:00:00:ad:c5:e8,model=e1000 -net tap,script=/tmp/
tmpRHVsoo -net nic,
macaddr=aa:00:00:15:ae:53,model=e1000 -net tap,script=/tmp/tmpNKQo3G
With the patch below I added the vlan parameter and now it looks like
this.
-net nic,vlan=0,macaddr=aa:00:00:ad:c5:e8,model=e1000 -net
tap,vlan=0,script=/tmp/tmpP8
9Lgq -net nic,vlan=1,macaddr=aa:00:00:15:ae:53,model=e1000 -net
tap,vlan=1,script=/tmp/tmpR5h0Xh
This works for great for me. The only part I'm not sure about is how
it interacts with multiple instances on the one machine. All my
instances have their nics in the same order but if one instance had
them reversed could this cause the same unintended bridging issue as
before? Also if someone knows how to tell tap interfaces to never
bridge that would be a better fix, after all the node is already
handling the proper setup of bridging.
diff -ru ganeti-2.0.6/lib/hypervisor/hv_kvm.py ganeti-2.0.6-tim/lib/
hypervisor/hv_kvm.py
--- ganeti-2.0.6/lib/hypervisor/hv_kvm.py 2010-02-04
04:00:22.000000000 -0700
+++ ganeti-2.0.6-tim/lib/hypervisor/hv_kvm.py 2010-02-26
09:17:37.975507115 -0700
@@ -412,10 +412,10 @@
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: