]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: cpu: unplug: Remove vcpu pinning on cold cpu unplug
authorPeter Krempa <pkrempa@redhat.com>
Fri, 15 Aug 2014 14:28:58 +0000 (16:28 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 18 Aug 2014 15:43:05 +0000 (17:43 +0200)
Remove the pinning info when removing to CPU, otherwise when the VM will
be started our code will try to pin non-existing vcpus as the definition
wasn't updated.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1129372

src/qemu/qemu_driver.c

index ac0717c6f976a3fa11461ce63fa7e43d5f7a550b..bff8f77bbce9e612fd22123545a8bfe158790562 100644 (file)
@@ -4277,6 +4277,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     qemuAgentCPUInfoPtr cpuinfo = NULL;
     int ncpuinfo;
     qemuDomainObjPrivatePtr priv;
+    size_t i;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG |
@@ -4386,6 +4387,12 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
         }
 
         if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+            /* remove vcpupin entries for vcpus that were unplugged */
+            if (nvcpus < persistentDef->vcpus) {
+                for (i = persistentDef->vcpus; i >= nvcpus; i--)
+                    virDomainVcpuPinDel(persistentDef, i);
+            }
+
             if (maximum) {
                 persistentDef->maxvcpus = nvcpus;
                 if (nvcpus < persistentDef->vcpus)