From d65307ab8bfeb67075bef1fb643aaaf3fa86a790 Mon Sep 17 00:00:00 2001
From: Feng Ni <fengni@huawei.com>
Date: Thu, 25 Jul 2019 20:29:11 +0800
Subject: [PATCH] qemu: clear vcpupin when unhotplug vcpu

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: Feng Ni <fengni@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 7e9c1a1..08b6e8b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -6008,6 +6008,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;
 
@@ -6293,6 +6296,8 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def,
 
             vcpu->online = false;
             vcpu->hotpluggable = VIR_TRISTATE_BOOL_YES;
+            virBitmapFree(vcpu->cpumask);
+            vcpu->cpumask = NULL;
 
             if (--curvcpus == nvcpus)
                 break;
-- 
2.19.1

