[libvirt] libvirt XML format.

Matthew Booth mbooth at redhat.com
Thu Feb 18 09:23:05 UTC 2010


On 18/02/10 05:28, Kumar L Srikanth-B22348 wrote:
> Now, I created a bridge br0 in the host machine with the IP 172.16.1.10.
> I want to assign an IP address[172.16.1.15] to the domain, so that the
> host machine and domain will ping each other. I tried to assign
> 'default' network to the domain by adding the following XML block to the
> above XML file:
>         <interface type='network'>
>           <source network='default'/>
>         </interface>
> But, when I start the domain I got the following error in the virsh
> console:
> 
> error: Failed to start domain vm1_fedora
> error: Failed to add veth0 device to virbr0: No such device

I'm not at all familiar with LXC domains, however I think I can see the
problem. The above network definition is for a managed network called
'default'. You can see its configuration using virsh. Here's mine:

# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>593e1d02-48b6-4ca2-ab49-8b1bca4ddb50</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

Note that the bridge is called 'virbr0'. You don't seem to have virbr0
on your system, so my guess is the default network has been stopped or
unconfigured somehow. However, it doesn't sound like you want to use a
managed network, you want to use your existing bridge. You need to
replace your XML above with the following:

 <interface type='bridge'>
  <source bridge='br0'/>
 </interface>

For more info have a look here:

http://libvirt.org/formatdomain.html#elementsNIC

Note the sections 'Virtual network' and 'Bridge to LAN'.

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the libvir-list mailing list