[libvirt] Interface pools and passthrough mode (issue to discuss)

Shradha Shah sshah at solarflare.com
Thu Dec 8 10:55:07 UTC 2011


Hello All,

While working on my patches I came across an issue which I would like to discuss with everybody.

The definition of passthrough mode in the Network XML Format document says that, in passthrough mode each physical interface can only be in use by a single guest interface at a time.

Consider the scenario where we a single KVM host:

We can define 2 network configurations, one that uses vepa and other that uses passthrough mode with the same interface pool. 

# virsh net-define vepa_network.xml
# virsh net-define passthrough-network.xml

Examples:

<network>
  <name>vepa-network</name>
  <uuid>81ff9090-c91e-6742-64da-4a736edb9a8f</uuid>
  <forward mode="vepa">
    <interface dev="eth10"/>
    <interface dev="eth11"/>
    <interface dev="eth12"/>
  </forward>
</network>

<network>
  <name>passthrough-network</name>
  <uuid>81ff9090-c91e-6742-64da-4a736edb9a88</uuid>
  <forward mode="passthrough">
    <interface dev="eth10"/>
    <interface dev="eth11"/>
    <interface dev="eth12"/>
  </forward>
</network>

Suppose we use the vepa-network for guest1 and passthrough network for guest2. 

Examples:

Guest 1: (snippet of xml)
<interface type='network'>
      <source network='vepa-network'/>
      <mac address='00:50:56:0e:86:3b'/>
      <actual type='direct'>
        <source mode='vepa'/>
      </actual>
</interface>

Guest2: (snippet of xml)
<interface type='network'>
      <source network='passthrough-network'/>
      <mac address='00:50:56:0e:86:4b'/>
      <actual type='direct'>
        <source mode='passthrough'/>
      </actual>
</interface>

# virsh define guest1.xml
# virsh define guest2.xml
# virsh start guest1
# virsh start guest2

Since the virNetworkDef is different for the two network configs, how does libvirt keep track of the interfaces in use at this point?

Wouldn't libvirt use the first free interface in both cases which will be eth10 since the usageCount will be zero in both cases start of day?

Many Thanks,

Regards,
Shradha Shah




More information about the libvir-list mailing list