qemu: use bdrv_flush_all for vm_stop et al

Reimplement bdrv_flush_all for vm_stop. In contrast to blk_flush_all,
bdrv_flush_all does not have device model restrictions. This allows
us to flush and halt unconditionally without error.

This allows us to do things like migrate when we have a device with
an open tray, but has a node that may need to be flushed, or nodes
that aren't currently attached to any device and need to be flushed.

Specifically, this allows us to migrate when we have a CDROM with
an open tray.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 22af08eacf)
Conflicts:
	cpus.c

* drop context dependancy on 6d0ceb80

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
John Snow 2016-09-22 21:45:51 -04:00 committed by Michael Roth
parent 8e94512568
commit 95200ebb50
1 changed files with 2 additions and 2 deletions

4
cpus.c
View File

@ -745,7 +745,7 @@ static int do_vm_stop(RunState state)
} }
bdrv_drain_all(); bdrv_drain_all();
ret = blk_flush_all(); ret = bdrv_flush_all();
return ret; return ret;
} }
@ -1488,7 +1488,7 @@ int vm_stop_force_state(RunState state)
bdrv_drain_all(); bdrv_drain_all();
/* Make sure to return an error if the flush in a previous vm_stop() /* Make sure to return an error if the flush in a previous vm_stop()
* failed. */ * failed. */
return blk_flush_all(); return bdrv_flush_all();
} }
} }