qemu-e2k/block
Paolo Bonzini 893f7ebafe mirror: introduce mirror job
This patch adds the implementation of a new job that mirrors a disk to
a new image while letting the guest continue using the old image.
The target is treated as a "black box" and data is copied from the
source to the target in the background.  This can be used for several
purposes, including storage migration, continuous replication, and
observation of the guest I/O in an external program.  It is also a
first step in replacing the inefficient block migration code that is
part of QEMU.

The job is possibly never-ending, but it is logically structured into
two phases: 1) copy all data as fast as possible until the target
first gets in sync with the source; 2) keep target in sync and
ensure that reopening to the target gets a correct (full) copy
of the source data.

The second phase is indicated by the progress in "info block-jobs"
reporting the current offset to be equal to the length of the file.
When the job is cancelled in the second phase, QEMU will run the
job until the source is clean and quiescent, then it will report
successful completion of the job.

In other words, the BLOCK_JOB_CANCELLED event means that the target
may _not_ be consistent with a past state of the source; the
BLOCK_JOB_COMPLETED event means that the target is consistent with
a past state of the source.  (Note that it could already happen
that management lost the race against QEMU and got a completion
event instead of cancellation).

It is not yet possible to complete the job and switch over to the target
disk.  The next patches will fix this and add many refinements to the
basic idea introduced here.  These include improved error management,
some tunable knobs and performance optimizations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-10-24 10:26:19 +02:00
..
Makefile.objs mirror: introduce mirror job 2012-10-24 10:26:19 +02:00
blkdebug.c blkdebug: process all set_state rules in the old state 2012-09-28 19:40:56 +02:00
blkverify.c block: replace unchecked strdup/malloc/calloc with glib 2012-01-26 11:39:03 +01:00
bochs.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
cloop.c block/cloop: Use g_free instead of free 2011-11-04 14:24:12 +01:00
commit.c block: rename block_job_complete to block_job_completed 2012-10-24 10:26:19 +02:00
cow.c block: Fix spelling in comment (ineffcient -> inefficient) 2012-04-19 15:48:52 +02:00
curl.c block/curl: Fix wrong free statement 2012-09-12 15:50:09 +02:00
dmg.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
gluster.c block: Support GlusterFS as a QEMU block backend. 2012-09-28 17:58:12 +02:00
iscsi.c Merge remote-tracking branch 'kwolf/for-anthony' into staging 2012-09-25 16:06:16 -05:00
mirror.c mirror: introduce mirror job 2012-10-24 10:26:19 +02:00
nbd.c cleanup qemu_co_sendv(), qemu_co_recvv() and friends 2012-06-11 23:12:11 +04:00
parallels.c block: take lock around bdrv_read implementations 2011-10-21 17:34:14 +02:00
qcow.c block: qcow image file reopen 2012-09-24 15:15:12 +02:00
qcow2-cache.c qcow2: always operate caches in writeback mode 2012-06-15 14:03:43 +02:00
qcow2-cluster.c qcow2: implement lazy refcounts 2012-08-06 22:39:14 +02:00
qcow2-refcount.c qcow2: preserve free_byte_offset when qcow2_alloc_bytes() fails 2012-07-09 15:53:01 +02:00
qcow2-snapshot.c qcow2: fix #ifdef'd qcow2_check_refcounts() callers 2012-07-09 15:53:01 +02:00
qcow2.c qcow2: mark this file's sole strncpy use as justified 2012-10-05 07:58:38 -05:00
qcow2.h qcow2: implement lazy refcounts 2012-08-06 22:39:14 +02:00
qed-check.c qed: mark image clean after repair succeeds 2012-08-10 10:25:12 +02:00
qed-cluster.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-gencb.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-l2-cache.c qed: do not evict in-use L2 table cache entries 2012-03-12 15:14:06 +01:00
qed-table.c cleanup useless return sentence 2012-10-05 15:10:21 +02:00
qed.c block: qed image file reopen 2012-09-24 15:15:12 +02:00
qed.h qed: mark image clean after repair succeeds 2012-08-10 10:25:12 +02:00
raw-posix-aio.h prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
raw-posix.c block: raw-posix image file reopen 2012-09-24 15:15:12 +02:00
raw-win32.c block: do not parse BDRV_O_CACHE_WB in block drivers 2012-09-24 15:15:11 +02:00
raw.c block: raw image file reopen 2012-09-24 15:15:12 +02:00
rbd.c block: do not parse BDRV_O_CACHE_WB in block drivers 2012-09-24 15:15:11 +02:00
sheepdog.c sheepdog: use bool for boolean variables 2012-10-12 10:47:35 +02:00
stream.c block: rename block_job_complete to block_job_completed 2012-10-24 10:26:19 +02:00
vdi.c block: vdi image file reopen 2012-09-24 15:15:12 +02:00
vmdk.c vmdk: relative_path: use pstrcpy in place of strncpy 2012-10-05 07:58:36 -05:00
vpc.c block: vpc image file reopen 2012-09-24 15:15:12 +02:00
vvfat.c block: Convert close calls to qemu_close 2012-08-15 10:48:57 +02:00