This patch series adds image streaming support for QED image files. Other image formats can be supported in the future.
Image streaming populates the file in the background while the guest is running. This makes it possible to start the guest before its image file has been fully provisioned. Example use cases include: * Providing small virtual appliances for download that can be launched immediately but provision themselves in the background. * Reducing guest provisioning time by creating local image files but backing them with shared master images which will be streamed. When image streaming is enabled, the contents of the backing file are written to the unallocated regions of the image file. This occurs in the background and the guest can perform regular I/O in the meantime. Once the entire backing file has been streamed the image no longer requires a backing file and it will drop its reference. Example invocation: $ # my_fedora.qed is a tiny file initially but will be streamed when the guest starts $ ./qemu-img create -f qed -o backing_file=fedora-14.img,copy_on_read=on,stream=on my_fedora.qed Formatting 'my_fedora.qed', fmt=qed size=10737418240 backing_file='fedora-14.img' cluster_size=0 table_size=0 copy_on_read=on stream=on $ # run the guest and stream fedora-14.img into my_fedora.qed $ x86_64-softmmu/qemu-system-x86_64 -m 512 -enable-kvm -drive if=virtio,file=my_fedora.qed,cache=none This patch series is structured as follows and is based on work that Adam Litke, Anthony Liguori, and I have done: [PATCH 1/8] block: add bdrv_aio_stream Introduce the .bdrv_aio_stream() BlockDriver interface. [PATCH 2/8] qmp: Add QMP support for stream commands Introduce monitor commands to start/stop image streaming as well as querying the state of image streaming. [PATCH 3/8] qed: add support for Copy-on-Read [PATCH 4/8] qed: intelligent streaming implementation [PATCH 5/8] qed: detect zero writes and skip them when to an unalloc Implement QED support for .bdrv_aio_stream(). [PATCH 6/8] blockdev: Allow image files to auto-enable streaming [PATCH 7/8] qed: Add QED_CF_STREAM flag to auto-enable streaming [PATCH 8/8] qed: Add -o stream=on image creation option Introduce a flag that auto-starts image streaming when the image file is opened. TODO * Settle on monitor interfaces and libvirt interaction * Streaming background I/O throttling * Additional testing