migration: Fail migration on bdrv_flush_all() error
authorKevin Wolf <kwolf@redhat.com>
Fri, 5 Jul 2013 11:54:55 +0000 (13:54 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 15 Jul 2013 07:51:40 +0000 (09:51 +0200)
commit0e1146a7a011a69d8cbc958b4f7ebad186730fc3
treeb0434969ad6edfb760b73205afb9c9105d223230
parent5698346391b306c2c84358c68ee897c095d714cc
migration: Fail migration on bdrv_flush_all() error

If bdrv_flush_all() returns an error, there is an inconsistency in the
view of an image file between the source and the destination host.
Completing the migration would lead to corruption. Better abort
migration in this case.

To reproduce this case, try the following (ensures that there is
something to flush, and then fails that flush):

$ qemu-img create -f qcow2 test.qcow2 1G
$ cat blkdebug.cfg
[inject-error]
event = "flush_to_os"
errno = "5"
$ qemu-system-x86_64 -hda blkdebug:blkdebug.cfg:test.qcow2 -monitor stdio
(qemu) qemu-io ide0-hd0 "write 0 4k"
(qemu) migrate ...

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
migration.c