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

Laine Stump laine at laine.org
Thu Dec 8 12:37:59 UTC 2011


On 12/08/2011 05:55 AM, Shradha Shah wrote:
> 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?

Yes. libvirt's network interface pools are currently completely 
autonomous, and there is no code to verify that they don't overlap; this 
is left up to the admin configuring the boxes. I've considered a patch 
to check for this by cycling through all the network definitions looking 
for identical entries (either to be done at the time of define or 
start), but haven't done it. Patches are always welcome, of course :-)




More information about the libvir-list mailing list