Running Ubuntu 12.04 we have 12 interfaces on the hypervisor which we want to expose in each vm. When we use only interface elements in the xml, we get the interfaces but we can't predict/control whether eth0 in the VM connects to eth0 on the HV. We've tried using the PCI bus numbering as seen in lspci to control it, but that doesn't seem to work.
Should we be defining our networks in a separate element in a network xml on the HV, or how should we configure?
sample from current xml for vm:
<interface type='hostdev'>
<source dev='eth3' mode='vepa'>
<address type='pci' domain='0x0000' bus='0x16' slot='0x10' function='0x1'/>
</source>
<target dev='macvtap0'/>
</interface>
<interface type='bridge'>
<source bridge='br4'/>
<target dev='vnet0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
The regular means to consistent mapping of NICs in Linux is by specifying the MAC address in the NIC definitions, or by using udev's
70-persistent-net-rules
If you define a MAC in the domXML (using bridged or macvtap passthrough modes), you control that MAC and can define it in the VM. If you are using vepa (you should have a switch that supports 802.1Qbg) then the MAC of the attached NIC should propagate into the VM and you can specify on which NIC in the VM the interface will reside (using udev or NIC configs or both)