[libvirt] RFC (v4): Add virDomainBlockPull API family to libvirt

Adam Litke agl at us.ibm.com
Tue Jun 14 14:36:46 UTC 2011


This round addresses all review comments from the last posting and should be
ready for inclusion.  Thanks for the review.

Changes since V3:
 - Don't check flags at the libvirt API level
 - qemu: Check disk->type before looking up alias
 - virsh: Merge blockpullall into blockpull
 - event: Drop events for unknown disk paths
 - Misc style fixes and comment updates

Changes since V2:
 - Rebased
 - Ensure error messages are consistent between JSON and Text interfaces
 - Added additional tests to the sample test bucket

Changes since V1:
 - Rebased to incorporate changes to generator and
   removal of static driver structure initializers
 - Other small fixups suggested by Matthias Bolte

To help speed the provisioning process for large domains, new QED disks are
created with backing to a template image.  These disks are configured with copy
on read such that blocks that are read from the backing file are copied to the
new disk.  This reduces I/O over a potentially costly path to the backing
image.

In such a configuration, there is a desire to remove the dependency on the
backing image as the domain runs.  To accomplish this, qemu will provide an
interface to perform sequential copy on read operations during normal VM
operation.  Once all data has been copied, the disk image's link to the backing
file is removed.

The virDomainBlockPull API family brings this functionality to libvirt.

virDomainBlockPullAll() instructs the hypervisor to stream the entire device in
the background.  Progress of this operation can be checked with the function 
virDomainBlockPullInfo().  An ongoing stream can be cancelled with
virDomainBlockPullAbort().  If a more controlled IO rate is desired,
virDomainBlockPull() can be used to perform a single increment of IO.
Subsequent calls to this function will automatically stream the appropriate
next increment until the disk has been fully populated.

An event (VIR_DOMAIN_EVENT_ID_BLOCK_PULL) will be emitted when a disk has been 
fully populated or if a BlockPullAll() operation was terminated due to an
error.  This event is useful to avoid polling on virDomainBlockPullInfo() for
completion and could also be used by the security driver to revoke access to
the backing file when it is no longer needed.

make check:                  PASS
make syntax-check:           PASS
make -C tests valgrind:      PASS

I am testing this API with Python Unittest (see the last patch).

[PATCH 1/8] Add new API virDomainBlockPull* to headers
[PATCH 2/8] virDomainBlockPull: Implement the main entry points
[PATCH 3/8] Add virDomainBlockPull support to the remote driver
[PATCH 4/8] Implement virDomainBlockPull for the qemu driver
[PATCH 5/8] Enable the virDomainBlockPull API in virsh
[PATCH 6/8] Enable virDomainBlockPull in the python API. 
[PATCH 7/8] Asynchronous event for BlockPull completion
[PATCH 8/8] test: Python Unittests for DomainBlockPull API




More information about the libvir-list mailing list