[libvirt] VirtualBox libvirt support sample XML file

Daniel P. Berrange berrange at redhat.com
Thu Apr 9 16:13:11 UTC 2009


On Thu, Apr 09, 2009 at 12:52:46PM +0200, Pritesh Kothari wrote:
> Hi All,
> 
> Just posting a sample XML file for creating a machine with all features 
> supported by the patch, so that it is easy for everyone to know which 
> features are supported till now, I am in process of adding the
> Documentation for same and thus posting this file till then.

Thanks, that's useful !

> 		<!--INTERNAL NETWORK -->
> 		<interface type='network'>
> 			<source network='int_net'/>
> 			<model type='am79c970a'/>
> 		</interface>
> 		
> 		<!--BRIDGE-->
> 		<interface type='bridge'>
> 			<source bridge='eth0'/>
> 			<mac address='00:16:3e:5d:c7:9e'/>
> 			<model type='am79c973'/>
> 		</interface>
> 
> 		<!--NAT-->
> 		<interface type='user'>
> 			<mac address='56:16:3e:5d:c7:9e'/>
> 			<model type='82540eM'/>
> 		</interface>
> 
> 		<!-- HOST ONLY NETWORK -->
> 		<interface type='ethernet'>
> 			<source dev='vboxnet0'/>
> 			<mac address='78:16:3e:4d:c7:9e'/>
> 			<model type='82543gc'/>
> 		</interface>

The Bridge & NAT  mappings you've defined here seem to make
good sense. 

I'm not so sure about the INTERNAL and HOST ONLY modes
though.

With the <interface type='network'>  configuration, the
source network is expected to refer to a network visible
and managed via the virNetwork*  APIs.

In QEMU / Xen drivers,  we have a generic network driver
impl that uses a bridge device, dnsmasq & iptables to
allow guests to talk to each other, optionaly talk to the
host, and then optionally  have NAT connectivity to the
outside world. This is the src/network_driver.c impl of
the virNetwork* APIs.

Conceptually the virNetwork APIs & their functionality ought
to map nicely onto the both the INTERNAL and HOST ONLY
networks modes virtual box has. 

The HOST ONLY mode, would map to a config without a 
<forward> tag (so guests & host can talk to each other).
The INTERNAL mode, wouldmap toa config without an 
<ip> tag (so guests can talk to each other, but not host)


What I'm not  clear on is where / how VirtualBox configures its
HOST ONLY and INTERNAL  networks ?  Does it have APIs for managing
these 2 configs as objects in their own right ? Or are they managed
implicilty via the VM config. The RPC stub code you posted  earlier
does not appear to have any APIs for directly configuring the
HOST ONLY / INTERNAL network configs, independantly of the VM config
I might be mis-reading something though..

I'm inclined to suggest that virtual box driver should provide its own
impl of the virNetwork internal driver API, in order to allow  direct
managemnet of the HOST ONLY & INTENRAL networks. Then for VM NICs,
both those would be done via a <interface type='network'> element.

 - Nat       -> type=user
 - Bridge    -> type=bridge
 - Host only -> type=network
 - Internal  -> type=network

Regards,
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