On Fri, Apr 8, 2011 at 2:31 PM, Daniel P. Berrange <berrange(a)redhat.com> wrote:
I have CCed Anthony and Kevin. Anthony drove the QED image streaming
and Kevin will probably be interested in the idea of allocating raw
images as a background activity while QEMU runs.
/*
* @path: fully qualified filename of the virtual disk
* @nregions: filled in the number of @region structs
* @regions: filled with a list of allocated regions
*
* Query the extents of allocated regions within the
* virtual disk file. The offsets in the list of regions
* are not guarenteed to be sorted in any explicit order.
*/
int virDomainBlockGetAllocationMap(virDomainPtr dom,
const char *path,
unsigned int *nregions,
virDomainBlockRegionPtr *regions);
QEMU can provide this with its existing .bdrv_is_allocated() function.
Kevin, do you have any thoughts on whether this API will work well?
This takes care of things for running guests. It would be
desirable to have the same functionality available when a
guest is not running, via the virStorageVol APIs. Indeed,
this would allow access to the allocation functionality
for disks not explicitly associated with any VM yet.
Today QEMU doesn't really cover the offline case although in the
future it may be possible to have a qemu-img command that preallocates
images and can be aborted.
Stefan