]> git.proxmox.com Git - qemu.git/commit - trace-events
mirror: introduce mirror job
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 Oct 2012 14:49:23 +0000 (16:49 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 24 Oct 2012 08:26:19 +0000 (10:26 +0200)
commit893f7ebafe4e8afc0ce4dbd9e64b3752f3036bbb
treec104f2308285a690ff3d9953a5e1b9946d2a5616
parenta66a2a368383e627b929bf42d1b972822491404b
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>
block/Makefile.objs
block/mirror.c [new file with mode: 0644]
block_int.h
qapi-schema.json
trace-events