]> Git Repo - qemu.git/commitdiff
migration: Don't allow migration if vm is in POSTMIGRATE
authorTuguoyi <[email protected]>
Tue, 8 Dec 2020 01:46:25 +0000 (01:46 +0000)
committerDr. David Alan Gilbert <[email protected]>
Fri, 18 Dec 2020 10:08:25 +0000 (10:08 +0000)
The following steps will cause qemu assertion failure:
- pause vm by executing 'virsh suspend'
- create external snapshot of memory and disk using 'virsh snapshot-create-as'
- doing the above operation again will cause qemu crash

The backtrace looks like:
    at /build/qemu-5.0/migration/savevm.c:1401
    at /build/qemu-5.0/migration/savevm.c:1453

When the first migration completes, bs->open_flags will set BDRV_O_INACTIVE
flag by bdrv_inactivate_all(), and during the second migration the
bdrv_inactivate_recurse assert that the bs->open_flags is already
BDRV_O_INACTIVE enabled which cause crash.

As Vladimir suggested, this patch makes migrate_prepare check the state of vm and
return error if it is in RUN_STATE_POSTMIGRATE state.

Signed-off-by: Tuguoyi <[email protected]>
Message-Id: <6b704294ad2e405781c38fb38d68c744@h3c.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reported-by: Li Zhang <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
migration/migration.c

index e0dbde4091c9402b68bc44e45508a899192eb9a5..f5d4a52c9560ed45a6cffc085c07e36af8621b0b 100644 (file)
@@ -2102,6 +2102,12 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
         return false;
     }
 
+    if (runstate_check(RUN_STATE_POSTMIGRATE)) {
+        error_setg(errp, "Can't migrate the vm that was paused due to "
+                   "previous migration");
+        return false;
+    }
+
     if (migration_is_blocked(errp)) {
         return false;
     }
This page took 0.032112 seconds and 4 git commands to generate.