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.
Note: I am sending this series out now (even though image streaming is not
quite committed to qemu upstream) because I want to start the review process.
At this stage, I expect only minor changes to the qemu implementation.
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 0/7] virDomainBlockPull: Add public symbols to libvirt API
[PATCH 2/7] Add virDomainBlockPull support to the remote driver
[PATCH 3/7] Implement virDomainBlockPull for the qemu driver
[PATCH 4/7] Enable the virDomainBlockPull API in virsh
[PATCH 5/7] Enable virDomainBlockPull in the python API.
[PATCH 6/7] Asynchronous event for BlockPull completion
[PATCH 7/7] test: Python Unittests for DomainBlockPull API