[libvirt] Allowing <interface type="none"> for network interface definition

Daniel P. Berrange berrange at redhat.com
Tue Dec 2 22:30:48 UTC 2008


On Tue, Dec 02, 2008 at 09:24:24PM +0000, Gihan Munasinghe wrote:
> Hi 
> 
> I am writing a management stack for our platform using libvirt. We have 
> many DomU images which all have PV drivers loaded for network.I want to 
> start these DomU guests with only the PV network device being visible from 
> within the DomU.
> 
> This is a requirement in the platform and hopefully, I presume there are 
> other people with the same requirement..
> 
> But when creating a server, libvirt sends (type ioemu) tag to xend. Which 
> make all of our vm's to have 2 network cards. Using the normal xm command I 
> can send type=none ( vif = [ 
> "mac=00:16:3e:00:a5:57,bridge=eth0,script=vif-bridge,type=none"]) to xend. 
> Which will send qeum-dm "-net none" switch which solves the problem.
> 
> After doing some investigation, I did some code change in libvirt0.5.0 to 
> support a attribute called "none" with in <interface type="">, that will 
> send xend the tag (type none). Allowing qeum-dm to be configured with "-net 
> none" switch.  ;-) 
> So you can define your network tag as 
> 
> <interface type='none'> <!-- This will send qeum-dm -net none switch -->
>    <!-- Other configurations will work as normal -->
>      <mac address='00:16:3e:00:a5:57'/>
>      <source bridge='eth0'/>
>      <target dev='vif47.0'/>
> </interface>
> 
> I this the proper way of doing it?  :-\ 

The "type" attribute is used to specify how the network card is connected
to the host networking. You're after something that changes what is 
exposed tto the guest.  The XML format for network interfaces already has 
support for a model element which accomplishes this. eg, for KVM we can
select VirtIO network card with:

    <interface type='bridge'>
        <model type="virtio"/>
        <source bridge='br0'/>
        <mac address='00:16:3e:00:a5:57'/>
    </interface>

This 'model' is not currently used in the Xen driver for libvirt, so
we should implement it. A value of 'none' doesn't really make sense.
For Xen >= 3.1.0, libvirt will no longer append type=ioemu by default.
This lets XenD configure by rtl8139 nic, and PV driver back/front.

So I think we just need to allow an explicit choice to override this

A couple of choices, either follow XenD's naming

   <model type="ioemu"/>
   <model type="netback"/>

Or take into account we might want to allow for full range of QEMU
nic choices, even if XenD doesn't (yet) expose it

   <model type="rtl8139"/>
   <model type="e1000"/>
   <model type="ne2k_pci"/>
   <model type="netback"/>

I think i tend towards the latter, since its more consistent with naming
in QEMU driver.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list