[libvirt] XenAPI remote storage - target path

Daniel P. Berrange berrange at redhat.com
Tue Mar 16 10:43:26 UTC 2010

On Tue, Mar 16, 2010 at 10:16:05AM +0000, Sharadha Prabhakar (3P) wrote:
> Hi,
> I'm trying to write a Remote Storage driver for XenAPI.
> I see that target-path is used for both storage pools and volumes.
> In the case of XenAPI remote storage, the storage is not mounted on the
> local host where libvirt is running. Storage is maintained in a remote location only.
> In this case how do I specify target-path and how do I go about creating
> a VM with storage using libvirt APIs with virsh and virt-manager. 
> Virt-manager expects me to give an absolute path for target-path. But In my case
> I don't have an absolute path. 
> Can I have a target path like this for a particular storage volume
> "/storage pool uuid/storage-vol uuid"? This will help me identify which storage pool is
> Libvirt talking about and which volume in it. Using this information I can fetch data from
> The remote location and give it back to libvirt. Is this approach
> ok or does libvirt support my specific remote storage case in some way. Could someone
> clarify please?

It may help to understand the usage scenario.

 - App creates a storage pool with a target '/foo'
 - App creates a storage volume called 'bar'
 - Storage pool driver creates a path for volume based on pool target and
   volume name. eg it might decide /foo/bar
 - App queries path of new volume and gets '/foo/bar'
 - App creates a new disk, passing '/foo/bar' in the <disk> element in
   the guest XML

The real key thing here is that 'virStorageVolGetPath' *must* return a path
suitable for use in the guest XML <disk> element <source file=/foo/bar>

To answer your question then, we ned to know what the path looks like that
you use to configure the guest disk when starting the guest ?  Once you
know that, then the storage driver must be implemented such that 
virStorageVolGetPath() returns a path that matches what XenAPI wants for
the guest config.  

As for pool target, if nothing else you can simply require that the pool
is configured with a target path of '/'  at which point it is essentially
ignorable, since all paths start with a '/' anyway.

|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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