qemu-e2k/migration
Kevin Wolf 76b1c7fe1c block: Inactivate BDS when migration completes
So far, live migration with shared storage meant that the image is in a
not-really-ready don't-touch-me state on the destination while the
source is still actively using it, but after completing the migration,
the image was fully opened on both sides. This is bad.

This patch adds a block driver callback to inactivate images on the
source before completing the migration. Inactivation means that it goes
to a state as if it was just live migrated to the qemu instance on the
source (i.e. BDRV_O_INACTIVE is set). You're then supposed to continue
either on the source or on the destination, which takes ownership of the
image.

A typical migration looks like this now with respect to disk images:

1. Destination qemu is started, the image is opened with
   BDRV_O_INACTIVE. The image is fully opened on the source.

2. Migration is about to complete. The source flushes the image and
   inactivates it. Now both sides have the image opened with
   BDRV_O_INACTIVE and are expecting the other side to still modify it.

3. One side (the destination on success) continues and calls
   bdrv_invalidate_all() in order to take ownership of the image again.
   This removes BDRV_O_INACTIVE on the resuming side; the flag remains
   set on the other side.

This ensures that the same image isn't written to by both instances
(unless both are resumed, but then you get what you deserve). This is
important because .bdrv_close for non-BDRV_O_INACTIVE images could write
to the image file, which is definitely forbidden while another host is
using the image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2016-01-20 13:36:23 +01:00
..
block.c
exec.c
fd.c
Makefile.objs
migration.c block: Inactivate BDS when migration completes 2016-01-20 13:36:23 +01:00
postcopy-ram.c
qemu-file-buf.c
qemu-file-internal.h
qemu-file-stdio.c
qemu-file-unix.c
qemu-file.c
ram.c Error reporting patches for 2016-01-13 2016-01-14 13:07:38 +00:00
rdma.c
savevm.c Error reporting patches for 2016-01-13 2016-01-14 13:07:38 +00:00
tcp.c
unix.c
vmstate.c vmstate: Introduce VMSTATE_VARRAY_MULTPLY 2016-01-16 12:01:23 +00:00
xbzrle.c