]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't try to update undefined guest CPU
authorJiri Denemark <jdenemar@redhat.com>
Mon, 20 Mar 2017 08:03:58 +0000 (09:03 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 20 Mar 2017 08:03:58 +0000 (09:03 +0100)
Calling virCPUUpdateLive on a domain with no guest CPU configuration
does not make sense. Especially when doing so would crash libvirtd.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_process.c

index 780f9587a8dc455ad8605b3401611978712c66ab..ec0e36d2e9fecb8c0f9b72d6b63e04f22c01ac1c 100644 (file)
@@ -3815,11 +3815,6 @@ qemuProcessVerifyCPUFeatures(virDomainDefPtr def,
 {
     int rc;
 
-    if (!def->cpu ||
-        (def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
-         !def->cpu->model))
-        return 0;
-
     rc = virCPUCheckFeature(def->os.arch, def->cpu, "invtsc");
 
     if (rc < 0) {
@@ -3870,6 +3865,13 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
             qemuProcessVerifyHypervFeatures(def, cpu) < 0)
             goto cleanup;
 
+        if (!def->cpu ||
+            (def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
+             !def->cpu->model)) {
+            ret = 0;
+            goto cleanup;
+        }
+
         if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
             goto cleanup;