[libvirt] libvirt XML format.

Kumar L Srikanth-B22348 B22348 at freescale.com
Thu Feb 18 05:28:10 UTC 2010


Thanks for the reply Matt.
I created a Linux Container(container1) using lxc-tools. I created a
Domain(container1_vm) using libvirt and want to mount that container
file system in the created Domain. For that, I created following XML
format:
<domain type='lxc' id='1'>
  <name>container1_vm</name>
    <memory>500000</memory>
      <os>
          <type>exe</type>
          <init>/bin/sh</init>
      </os>
      <vcpu>1</vcpu>
      <clock offset='utc'/>
      <on_poweroff>destroy</on_poweroff>
      <on_reboot>restart</on_reboot>
      <on_crash>destroy</on_crash>
      <devices>
        <emulator>/usr/libexec/libvirt_lxc</emulator>
  	<filesystem type='mount'>
	  <source dir='/var/lib/lxc/container1/rootfs/rootfs'/> 
	  <target dir='/'/> 
	</filesystem>
	<console type='pty' />
      </devices>
</domain>

The above XML worked fine, and domain started.
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

Can you please let me know the XML format for assigning a statis IP
address to the Domain?

Regards,
Srikanth.

-----Original Message-----
From: libvir-list-bounces at redhat.com
[mailto:libvir-list-bounces at redhat.com] On Behalf Of Matthew Booth
Sent: Wednesday, February 17, 2010 7:38 PM
To: libvir-list at redhat.com
Subject: Re: [libvirt] libvirt XML format.

On 17/02/10 12:36, Kumar L Srikanth-B22348 wrote:
> Hi,

Hi Kumar,

> I have some doubts regarding libvirt XML format.
> Can anyone please let me know in detail, what is /<source>/ and 
> /<target>/ tags in the libvirt XML format?

The best documentation is available here:
http://libvirt.org/formatdomain.html

If that's not enough, could you post an example of what you're trying to
do? Doesn't matter if it's wrong.

> Can I put '/' in the /<target>/ tag or are there any exceptions if I 
> put '/' in that?

The domain XML is a valid XML document. Syntactically, you can put /
anywhere it would be valid in an XML document.

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

--
libvir-list mailing list
libvir-list at redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list





More information about the libvir-list mailing list