Remove the pointer from def->cputune.vcpupin after unplugging
the CPU and also free the bitmap contained in the structure
by calling virDomainVcpuPinDel instead of VIR_FREE.

Introduced by commit 0df1a79.

This makes virDomainLookupVcpuPin redundant.

https://bugzilla.redhat.com/show_bug.cgi?id=1088165
---
 src/conf/domain_conf.c   | 20 --------------------
 src/conf/domain_conf.h   |  3 ---
 src/libvirt_private.syms |  1 -
 src/qemu/qemu_driver.c   |  6 +-----
 4 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 05fa3f9..cb0df3d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10966,26 +10966,6 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
     goto cleanup;
 }
 
-/*
- * Return the vcpupin related with the vcpu id on SUCCESS, or
- * NULL on failure.
- */
-virDomainVcpuPinDefPtr
-virDomainLookupVcpuPin(virDomainDefPtr def,
-                       int vcpuid)
-{
-    size_t i;
-
-    if (!def->cputune.vcpupin)
-        return NULL;
-
-    for (i = 0; i < def->cputune.nvcpupin; i++) {
-        if (def->cputune.vcpupin[i]->vcpuid == vcpuid)
-            return def->cputune.vcpupin[i];
-    }
-
-    return NULL;
-}
 
 int
 virDomainDefMaybeAddController(virDomainDefPtr def,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2ff0bc4..3426c48 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2671,9 +2671,6 @@ int virDomainObjListExport(virDomainObjListPtr doms,
                            virDomainObjListFilter filter,
                            unsigned int flags);
 
-virDomainVcpuPinDefPtr virDomainLookupVcpuPin(virDomainDefPtr def,
-                                              int vcpuid);
-
 int
 virDomainDefMaybeAddController(virDomainDefPtr def,
                                int type,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0e81f2f..972b184 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -292,7 +292,6 @@ virDomainLifecycleTypeToString;
 virDomainLiveConfigHelperMethod;
 virDomainLockFailureTypeFromString;
 virDomainLockFailureTypeToString;
-virDomainLookupVcpuPin;
 virDomainMemballoonModelTypeFromString;
 virDomainMemballoonModelTypeToString;
 virDomainMemDumpTypeFromString;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5970585..3fbaa62 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4120,8 +4120,6 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
         }
     } else {
         for (i = oldvcpus - 1; i >= nvcpus; i--) {
-            virDomainVcpuPinDefPtr vcpupin = NULL;
-
             if (priv->cgroup) {
                 if (virCgroupNewVcpu(priv->cgroup, i, false, &cgroup_vcpu) < 0)
                     goto cleanup;
@@ -4132,9 +4130,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
             }
 
             /* Free vcpupin setting */
-            if ((vcpupin = virDomainLookupVcpuPin(vm->def, i))) {
-                VIR_FREE(vcpupin);
-            }
+            ignore_value(virDomainVcpuPinDel(vm->def, i));
         }
     }
 
-- 
1.8.3.2

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

Reply via email to