migration: savevm: consult migration blockers
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 14 Nov 2018 09:48:00 +0000 (10:48 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 27 Nov 2018 14:06:14 +0000 (15:06 +0100)
There is really no difference between live migration and savevm, except
that savevm does not require bdrv_invalidate_cache to be implemented
by all disks.  However, it is unlikely that savevm is used with anything
except qcow2 disks, so the penalty is small and worth the improvement
in catching bad usage of savevm.

Only one place was taking care of savevm when adding a migration blocker,
and it can be removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
migration/savevm.c
target/i386/kvm.c

index ef707b8c439a7dcb3e101873287bf00818a8e445..1c49776a9158a3b869b0b6c021bda5d4e7535234 100644 (file)
@@ -2455,6 +2455,10 @@ int save_snapshot(const char *name, Error **errp)
     struct tm tm;
     AioContext *aio_context;
 
+    if (migration_is_blocked(errp)) {
+        return false;
+    }
+
     if (!replay_can_snapshot()) {
         error_setg(errp, "Record/replay does not allow making snapshot "
                    "right now. Try once more later.");
index 272480068631675492515467ef618e44f1020e02..b2401d13ea732255c323cf4260b9566c222695c1 100644 (file)
@@ -1266,7 +1266,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
     if (!env->user_tsc_khz) {
         if ((env->features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
             invtsc_mig_blocker == NULL) {
-            /* for migration */
             error_setg(&invtsc_mig_blocker,
                        "State blocked by non-migratable CPU device"
                        " (invtsc flag)");
@@ -1276,8 +1275,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
                 error_free(invtsc_mig_blocker);
                 return r;
             }
-            /* for savevm */
-            vmstate_x86_cpu.unmigratable = 1;
         }
     }