]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Use virCPUCheckFeature in qemuMigrationIsAllowed
authorJiri Denemark <jdenemar@redhat.com>
Fri, 24 Mar 2017 08:27:16 +0000 (09:27 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 27 Mar 2017 18:16:32 +0000 (20:16 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_migration.c

index 3e789a7a7e1fcdda0842f2a3026bb59ab82b7573..86a66b5ef072d96cc2b2d0b9ed9d6f9d9e4823d9 100644 (file)
@@ -2473,19 +2473,12 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
             return false;
 
         if (vm->def->cpu) {
-            for (i = 0; i < vm->def->cpu->nfeatures; i++) {
-                virCPUFeatureDefPtr feature = &vm->def->cpu->features[i];
-
-                if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
-                    continue;
-
-                /* QEMU blocks migration and save with invariant TSC enabled */
-                if (STREQ(feature->name, "invtsc")) {
-                    virReportError(VIR_ERR_OPERATION_INVALID,
-                                   _("domain has CPU feature: %s"),
-                                   feature->name);
-                    return false;
-                }
+            /* QEMU blocks migration and save with invariant TSC enabled */
+            if (virCPUCheckFeature(vm->def->os.arch, vm->def->cpu,
+                                   "invtsc") == 1) {
+                virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                               _("domain has 'invtsc' CPU feature"));
+                return false;
             }
         }