[Libvir] Creating a Domain

Richard W.M. Jones rjones at redhat.com
Fri Oct 26 08:30:58 UTC 2007


chetan saundankar wrote:
> Hi all,
> I am new to Libvirt. I have few questions on how to create a guest 
> domain using libvirt,
> 1. I want to create a guest and say install FC6 in it. Can it be done 
> using "virDomainCreate" or "virDomainCreateLinux" calls? and specifying 
> iso image in Domain description XML e.g.

Yes, you would use virDomainCreateLinux.  Despite the name, this is the 
call for creating guests of many different types.

virDomainCreate is slightly different -- it takes a domain which already 
exists but is shut down ("defined" in the terminology) and starts it 
running.  Basically the same as 'virsh start'.

Now while it is possible to create the XML by hand for 
virDomainCreateLinux (see: http://libvirt.org/format.html) we also have 
a library and command-line tool for doing it, and depending on what you 
need that might be easier to use: "virt-install" from 
http://www.virt-manager.org/scmrepo.html

> <disk type='file' device='cdrom'>
>       <source file='/root/chelsea/fc6-x86.iso '/>
>       <target dev='hdc'/>
>       <readonly/>
> </disk>

You need the complete XML, see http://libvirt.org/format.html .

> 2. In the Domain Description XML for Fully virtualized guests there is 
> <uuid> tag so if the above mentioned method is used to create guests 
> then is it the callers responsibility to provide a unique uuid?

I looked at the code and it seems like it is up to xend to create a UUID 
if you don't supply one in the XML.  Therefore you'd be relying on xend 
to do this.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071026/608f0986/attachment-0001.bin>


More information about the libvir-list mailing list