[libvirt] block pull/commit for non-local storage

Martin Kletzander mkletzan at redhat.com
Thu Feb 20 14:30:56 UTC 2014


On Thu, Feb 20, 2014 at 02:46:03PM +0100, Peter Krempa wrote:
> Hi,
>
> with my recent work into snapshots with native libgfapi support I've run
> into an issue with libvirt APIs used to delete snapshots by management apps.
>
> The management apps use the APIs to do the job:
> int
> virDomainBlockCommit(virDomainPtr dom, const char *disk,
>                      const char *base, const char *top,
>                      unsigned long bandwidth, unsigned int flags)
>
> int
> virDomainBlockPull(virDomainPtr dom, const char *disk,
>                    unsigned long bandwidth, unsigned int flags)
>
> int
> virDomainBlockRebase(virDomainPtr dom, const char *disk,
>                      const char *base, unsigned long bandwidth,
>                      unsigned int flags)
>
> As you can see in the prototypes of these functions (and from the docs
> for them which I'm not going to copy here) the user can provide the disk
> specification in two possible options:
>
> 1) a full path if it's unambiguous - this is file centric and requires
> the file to be in the local filesystem
>
> 2) a disk name "vda" - this is selected automatically by libvirt but
> allows to specify only the top image.
>
> For systems that want to use remote storage without local representation
> such as gluster+libgfapi, this doesn't allow to use the APIs to start
> block jobs.
>
> To solve this issue we need a way to specify paths on remote storage in
> some way. Below are two options we've discussed on IRC.
>
> 1) Use URIs along with the file path to specify disk images.
>
> This option would add a new, possibly well documented URIs to specify
> paths for disk images. These would be libvirt defined URIs (but
> surprisingly "similar" to qemu URIS) so that hypervisors with different
> storage specification would need a conversion.
>
> This would allow to specify the targets as:
> vda - disk name
> /path/to/file - legacy way, path
> file:///path/to/file - new way of file paths
> block:///dev/blah - new way, block devs
> gluster://server/vol/img - new way, remote images
> ...
>

And we can add our specific thing in there without (hopefully)
breaking anything (e.g. new schemas, parameters).

> Possible caveats: RBD for example allows to use multiple hosts and we'd
> need to introduce a possibility to specify it if we'd add support for
> this on rbd.
>

This could be example no. 1 how we can make workaround something using
our URIs, for example:

"libvirt-rbd://main-host/path-or-volume?additional_hosts[]=host2&additional_hosts[]=host3"

even though this looks *very* ugly...

NB: if qemu will support this, we'll have to pass them a string
anyway, won't we?  So they'd make the job for us.

> 2) Export the image chain in the XML and allow to use indexed disk names
> This option would require to export the backing chain in the XML in some
> way, either the existing disk source specification in multiple elements
> (which I don't like as it is a bit convoluted), or possibly again via URIs.
>
> Then the user would be allowed to specify vda[2] for the second backing
> image of the vda disk.
>

I thought about something similar, specifying "vda~1" "vda~3" would be
unique and still simple enough to use.  I, however, don't understand
why would we need to export the backing chain in the XML.  If the
management app wants to do a rebase, it must know from-to relative to
the top image anyway.  Or did I miss something?

> With this the internal representations of the backing chain would be
> used without the need for the user to specify path.
>
> A possible caveat here is that if backing chains for some reason will be
> converted to backing trees, this approach will be invalid.
>

We'd have this issue with URIs as well, but backing trees don't make
sense with current qemu implementation anyway, if I understand that
correctly.

> 3) ? anyone suggesting something better? :)
>
> Thanks in advance for suggestions and/or new ideas.
>

You're welcome.

> Peter
>

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140220/6dcac043/attachment-0001.sig>


More information about the libvir-list mailing list