[libvirt] [RFC] Storage volume clone API
crobinso at redhat.com
Wed Apr 15 19:28:54 UTC 2009
Attached is a stab at an API for cloning a storage volume. This patch
implements the command for FS volumes, along with a virsh command
'vol-clone'. This builds on the previously posted 'drop pool lock during
volume creation' work.
The new API call looks like:
* @vol: pointer to storage vol to clone
* @xmldesc: description of volume to create
* @flags: flags for creation (unused, pass 0)
* Clone a storage volume within the parent pool.
* Information for the new volume (name, perms)
* are passed via a typical volume XML description
* Not all pools support cloning of volumes
* return the storage volume, or NULL on error
const char *xmldesc,
unsigned int flags)
The user passes information about the new volume via <volume> XML.
Currently we only use the passed name and permissions values, but
backingStore info could also be relevant, and 'format' if we allow
cloning between image formats.
- Parsing the 'clone' xml will complain if the 'capacity' element hasn't
been specified, even though it is meaningless for the new volume. Not
too sure what the right thing to do here is.
- A clone of a raw sparse file will turn out fully allocated. Could
probably borrow code from 'cp' to try and get this right.
- Doesn't handle backing stores. I think we would need to call out to
'qemu-img convert' to have any chance of getting this right. And if we
do that, we could also allow cloning from one image format to another.
A lot of the patch is just plumbing, which I will break out into
separate patches on the next post. For now, most of the interesting bits
are at near the bottom.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 55033 bytes
Desc: not available
More information about the libvir-list