[libvirt] [PATCH] qemu: clear vcpupin when unhotplug vcpu

Xu Yandong posted 1 patch 4 years, 7 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1568880114-88172-1-git-send-email-xuyandong2@huawei.com
src/qemu/qemu_hotplug.c | 5 +++++
1 file changed, 5 insertions(+)
[libvirt] [PATCH] qemu: clear vcpupin when unhotplug vcpu
Posted by Xu Yandong 4 years, 7 months ago
step1: hotplug vcpus
step2: pin vcpus
step3: unhotplug vcpus
As a result, vcpu pin info still show up in xml.
So we need clear it.

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 src/qemu/qemu_hotplug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 62e505b779..df94b54d09 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -6105,6 +6105,9 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver,
 
     qemuDomainVcpuPersistOrder(vm->def);
 
+    virBitmapFree(vcpuinfo->cpumask);
+    vcpuinfo->cpumask = NULL;
+
     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
         goto cleanup;
 
@@ -6390,6 +6393,8 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def,
 
             vcpu->online = false;
             vcpu->hotpluggable = VIR_TRISTATE_BOOL_YES;
+            virBitmapFree(vcpu->cpumask);
+            vcpu->cpumask = NULL;
 
             if (--curvcpus == nvcpus)
                 break;
-- 
2.18.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: clear vcpupin when unhotplug vcpu
Posted by Peter Krempa 4 years, 7 months ago
On Thu, Sep 19, 2019 at 04:01:54 -0400, Xu Yandong wrote:
> step1: hotplug vcpus
> step2: pin vcpus
> step3: unhotplug vcpus
> As a result, vcpu pin info still show up in xml.
> So we need clear it.
> 
> Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
> ---

The idea is that you can pre-configure the vcpu pinning info before
hotplugging the cpu. This means that the pinning is a configuration
value even if the vCPU is offline thus the existing behaviour is
desired.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list