qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 00/13] QED image streaming


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH 00/13] QED image streaming
Date: Tue, 14 Jun 2011 19:18:18 +0100

Overview
--------

This patch series adds image streaming support for QED image files.  Other
image formats can also 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 unallocated regions of the image file are
populated with the data from the backing 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 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 my_fedora.qed
Formatting 'my_fedora.qed', fmt=qed size=10737418240 
backing_file='fedora-14.img' cluster_size=0 table_size=0

$ # 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,stream=on

Details on changes
------------------

Image streaming introduces a new bdrv_aio_copy_backing() interface.  Block
drivers that implement this interface support streaming.  This function scans
for an unallocated cluster and populates it with data from the backing file.

The details of populating the image file are actually best implemented as a
copy-on-read operation.  Copy-on-read means that a read request will populate
the image file if it needs to fetch data from the backing file.  The
copy-on-read feature can be used outside the context of streaming and this
patch series therefore introduces the -drive copy-on-read=on option for that
purpose.

Two new monitor interfaces are introduced: block_stream and query-block-stream.
They can be used to start streaming a block device and to poll progress.  QMP
events are raised on completion and failure so that polling is not required.
Adam Litke <address@hidden> has implemented the libvirt APIs for image
streaming:
http://permalink.gmane.org/gmane.comp.emulators.libvirt/40080

Patches 1-2
qemu-config: },{ -> }, { to please checkpatch.pl
block: add -drive copy-on-read=on|off

  These patches add the -drive copy-on-read=on|off option although no block
  driver supports it yet.

Patches 3-7
qed: replace is_write with flags field
qed: extract qed_start_allocating_write()
qed: make qed_aio_write_alloc() reusable
qed: add support for copy-on-read
qed: avoid deadlock on emulated synchronous I/O

  These patches add copy-on-read support to the QED block driver.

Patches 8-11
qerror: add qerror_from_args() to create qerror objects
block: add bdrv_aio_copy_backing()
qmp: add QMP support for stream commands
block: add -drive stream=on|off

  These patches add the -drive stream=on|off and monitor commands for image
  streaming.

Patch 12
qed: intelligent streaming implementation

  This patch adds image streaming support to the QED block driver.

Patch 13
trace: trace bdrv_aio_readv/writev error paths

  This patch adds helpful trace events for block layer debugging.

v1:
 * -drive copy-on-read=on|off,stream=on|off instead of image header bits
 * Latest libvirt API compatibility
 * Workaround and assert for synchronous I/O emulation deadlock

Anthony Liguori (4):
  qed: add support for copy-on-read
  block: add bdrv_aio_copy_backing()
  qmp: add QMP support for stream commands
  qed: intelligent streaming implementation

Stefan Hajnoczi (9):
  qemu-config: },{ -> }, { to please checkpatch.pl
  block: add -drive copy-on-read=on|off
  qed: replace is_write with flags field
  qed: extract qed_start_allocating_write()
  qed: make qed_aio_write_alloc() reusable
  qed: avoid deadlock on emulated synchronous I/O
  qerror: add qerror_from_args() to create qerror objects
  block: add -drive stream=on|off
  trace: trace bdrv_aio_readv/writev error paths

 block.c         |   66 +++++++++-
 block.h         |    6 +
 block/qed.c     |  363 ++++++++++++++++++++++++++++++++++++++++++++++--------
 block/qed.h     |    8 +-
 block_int.h     |    3 +
 blockdev.c      |  286 +++++++++++++++++++++++++++++++++++++++++++
 blockdev.h      |    6 +
 hmp-commands.hx |   24 ++++-
 monitor.c       |   23 ++++
 monitor.h       |    1 +
 qemu-config.c   |  166 +++++++++++++------------
 qemu-options.hx |   12 ++-
 qerror.c        |   30 +++++
 qerror.h        |   12 ++
 qmp-commands.hx |   68 ++++++++++
 trace-events    |   10 ++-
 16 files changed, 940 insertions(+), 144 deletions(-)

-- 
1.7.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]