提交 07b70bfb 编写于 作者: M Markus Armbruster 提交者: Kevin Wolf

savevm: Include writable devices with removable media

savevm and loadvm silently ignore block devices with removable media,
such as floppies and SD cards.  Rolling back a VM to a previous
checkpoint will *not* roll back writes to block devices with removable
media.

Moreover, bdrv_is_removable() is a confused mess, and wrong in at
least one case: it considers "-drive if=xen,media=cdrom -M xenpv"
removable.  It'll be cleaned up later in this series.

Read-only block devices are also ignored, but that's okay.

Fix by ignoring only read-only block devices and empty block devices.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 c602a489
......@@ -2097,7 +2097,7 @@ void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event)
int bdrv_can_snapshot(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
if (!drv || bdrv_is_removable(bs) || bdrv_is_read_only(bs)) {
if (!drv || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
return 0;
}
......
......@@ -1914,7 +1914,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
bs = NULL;
while ((bs = bdrv_next(bs))) {
if (bdrv_is_removable(bs) || bdrv_is_read_only(bs)) {
if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
continue;
}
......@@ -2034,7 +2034,7 @@ int load_vmstate(const char *name)
bs = NULL;
while ((bs = bdrv_next(bs))) {
if (bdrv_is_removable(bs) || bdrv_is_read_only(bs)) {
if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
continue;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册