[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Create a Domain from windows client



On Mon, Aug 31, 2009 at 07:38:18PM +0530, anuj rampal wrote:
> Hi all,
> 
> I'm trying to call the libvirt API from my Windows machine.
> 
> When i try to create to a Domain using "virDomainDefineXML" function
> 
> I have to pass an XML file containing the Description of the Domain.
> 
> Here is the part of the XML file that im using:
> 
> <domain type='qemu' id='1'>
> ..
> ..
>   <devices>
>     <emulator>/usr/bin/qemu</emulator>
>     <disk type='file' device='disk'>
>       <source file='/var/lib/libvirt/images/WinXp.img'/>
>       <target dev='hda' bus='ide'/>
>     </disk>
>     <disk type='file' device='cdrom'>
>       <source file='/home/anuj/ISOs/WinXpSp3/Windows_XP_SP3.iso'/>
>       <target dev='hdc' bus='ide'/>
>       <readonly/>
>     </disk>
> ..
> ..
> </domain>
> 
> <source file='/var/lib/libvirt/images/WinXp.img'/>
> This is the path which contains the img file for the Domain.
> 
> I have created this file using this command:
> 
> qemu-img create -f raw /var/lib/libvirt/images/WinXp.img 10G
> 
> *Now: my question is:*
> 
> Is there a way by which i can create this img file using some libvirt call
> directly and then use this for my domain creation.

Yes, you want to use the 'virStoragePool' APIs to create a directory based
storage pool. You can then use the virStorageVol APIs to create individual
files in that directory, including qcow2, raw, vmdk, etc files.


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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]