From e9ff957ac26e0e11869a3568cfa7423ae33c51e7 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 19 Nov 2015 09:42:01 +0300 Subject: snapshot: create helper to test that block drivers supports snapshots The patch enforces proper locking for this operation. Signed-off-by: Denis V. Lunev Reviewed-by: Greg Kurz Reviewed-by: Stefan Hajnoczi Reviewed-by: Fam Zheng Reviewed-by: Juan Quintela CC: Kevin Wolf Tested-by: Greg Kurz Signed-off-by: Juan Quintela --- migration/savevm.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'migration') diff --git a/migration/savevm.c b/migration/savevm.c index d90e228568..4646aa1178 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1958,19 +1958,10 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) const char *name = qdict_get_try_str(qdict, "name"); Error *local_err = NULL; - /* Verify if there is a device that doesn't support snapshots and is writable */ - bs = NULL; - while ((bs = bdrv_next(bs))) { - - if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { - continue; - } - - if (!bdrv_can_snapshot(bs)) { - monitor_printf(mon, "Device '%s' is writable but does not support snapshots.\n", - bdrv_get_device_name(bs)); - return; - } + if (!bdrv_all_can_snapshot(&bs)) { + monitor_printf(mon, "Device '%s' is writable but does not " + "support snapshots.\n", bdrv_get_device_name(bs)); + return; } bs = find_vmstate_bs(); -- cgit v1.2.3