From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QobHi-0005NI-6j for qemu-devel@nongnu.org; Wed, 03 Aug 2011 09:14:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QobHg-0002XM-Bf for qemu-devel@nongnu.org; Wed, 03 Aug 2011 09:14:54 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:36919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QobHf-0002W8-WF for qemu-devel@nongnu.org; Wed, 03 Aug 2011 09:14:52 -0400 From: Markus Armbruster Date: Wed, 3 Aug 2011 15:08:11 +0200 Message-Id: <1312376904-16115-33-git-send-email-armbru@redhat.com> In-Reply-To: <1312376904-16115-1-git-send-email-armbru@redhat.com> References: <1312376904-16115-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 32/45] savevm: Include writable devices with removable media List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, quintela@redhat.com, stefano.stabellini@eu.citrix.com, lcapitulino@redhat.com, hare@suse.de, amit.shah@redhat.com, hch@lst.de 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: Markus Armbruster --- block.c | 2 +- savevm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index 1ff42b5..b3a5ee7 100644 --- a/block.c +++ b/block.c @@ -2047,7 +2047,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; } diff --git a/savevm.c b/savevm.c index 7801aa7..839712e 100644 --- a/savevm.c +++ b/savevm.c @@ -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; } -- 1.7.6