[libvirt] [RFC]: Volume allocation progress reporting

Cole Robinson crobinso at redhat.com
Tue Mar 24 21:20:29 UTC 2009


The attached patch implements storage volume allocation progress
reporting for file volumes.

Currently, the volume creation process looks like:

- Grab the pool lock
- Fully allocated the volume
- 'define' the volume (so it shows up in 'virsh vol-list', etc)
- Lookup the volume object to return
- Drop the pool lock

The new sequence is:

- Grab the pool lock
- 'define' the volume (even though nothing is on disk yet)
- Drop the pool lock
- Allocate the volume as needed
- Regrab the pool lock
- Lookup the volume object to return
- Drop the pool lock (again)

Since the volume is 'defined', the user can fetch an object reference in
a separate thread, and continually poll the 'info' command for up to
date numbers. This also has the benefit of dropping the pool lock during
the potentially lengthy allocation, as currently 'virsh pool-list' etc.
will block while any volume is being allocated.

Non file volumes maintain existing behavior.

I tried to make the implementation resistant to user error: say if the
pool is deactivated or deleted while the volume is being allocated. The
creation process may bail out, but I couldn't produce any bad errors
(crashing).

There are a few other small fixes in this patch:

- Refresh volume info when doing volume dumpxml
- Update volume capacity when doing a refresh

I've also attached an ugly python script that can test this. Presuming
you have a pool named 'default', running

python sparse.py --vol-create-info

Will launch an allocation, print vol.info in a loop.

Feedback appreciated.

Thanks,
Cole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-storage-progress.patch
Type: text/x-patch
Size: 14777 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090324/077b6e62/attachment-0001.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sparse.py
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090324/077b6e62/attachment-0001.ksh>


More information about the libvir-list mailing list