[PATCH 03/12] Convert virDomainPinDefPtr->vcpuid to virDomainPinDefPtr->id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we're not specifically a vcpu related structure anymore...

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 39 +++++++++++++++++++--------------------
 src/conf/domain_conf.h   |  2 +-
 src/libxl/libxl_domain.c |  2 +-
 src/libxl/libxl_driver.c |  2 +-
 src/qemu/qemu_cgroup.c   |  8 ++++----
 src/qemu/qemu_driver.c   |  2 +-
 6 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e54dc1..04de04e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2015,7 +2015,7 @@ virDomainVcpuPinDefCopy(virDomainPinDefPtr *src, int nvcpupin)
     for (i = 0; i < nvcpupin; i++) {
         if (VIR_ALLOC(ret[i]) < 0)
             goto error;
-        ret[i]->vcpuid = src[i]->vcpuid;
+        ret[i]->id = src[i]->id;
         if ((ret[i]->cpumask = virBitmapNewCopy(src[i]->cpumask)) == NULL)
             goto error;
     }
@@ -12736,7 +12736,7 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
             goto error;
         }
 
-        def->vcpuid = vcpuid;
+        def->id = vcpuid;
     }
 
     if (iothreads && (tmp = virXPathString("string(./@iothread)", ctxt))) {
@@ -12763,8 +12763,7 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
             goto error;
         }
 
-        /* Rather than creating our own structure we are reusing the vCPU */
-        def->vcpuid = iothreadid;
+        def->id = iothreadid;
     }
 
     if (!(tmp = virXMLPropString(node, "cpuset"))) {
@@ -13472,14 +13471,14 @@ virDomainDefParseXML(xmlDocPtr xml,
 
         if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin,
                                         def->cputune.nvcpupin,
-                                        vcpupin->vcpuid)) {
+                                        vcpupin->id)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("duplicate vcpupin for same vcpu"));
             virDomainVcpuPinDefFree(vcpupin);
             goto error;
         }
 
-        if (vcpupin->vcpuid >= def->vcpus) {
+        if (vcpupin->id >= def->vcpus) {
             /* To avoid the regression when daemon loading
              * domain confs, we can't simply error out if
              * <vcpupin> nodes greater than current vcpus,
@@ -13516,7 +13515,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                 goto error;
             }
             virBitmapCopy(vcpupin->cpumask, def->cpumask);
-            vcpupin->vcpuid = i;
+            vcpupin->id = i;
             def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
         }
     }
@@ -13564,7 +13563,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 
         if (virDomainVcpuPinIsDuplicate(def->cputune.iothreadspin,
                                         def->cputune.niothreadspin,
-                                        iothreadpin->vcpuid)) {
+                                        iothreadpin->id)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("duplicate iothreadpin for same iothread"));
             virDomainVcpuPinDefFree(iothreadpin);
@@ -16673,7 +16672,7 @@ virDomainDefAddImplicitControllers(virDomainDefPtr def)
     return 0;
 }
 
-/* Check if vcpupin with same vcpuid already exists.
+/* Check if vcpupin with same id already exists.
  * Return 1 if exists, 0 if not. */
 int
 virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
@@ -16686,7 +16685,7 @@ virDomainVcpuPinIsDuplicate(virDomainPinDefPtr *def,
         return 0;
 
     for (i = 0; i < nvcpupin; i++) {
-        if (def[i]->vcpuid == vcpu)
+        if (def[i]->id == vcpu)
             return 1;
     }
 
@@ -16704,7 +16703,7 @@ virDomainVcpuPinFindByVcpu(virDomainPinDefPtr *def,
         return NULL;
 
     for (i = 0; i < nvcpupin; i++) {
-        if (def[i]->vcpuid == vcpu)
+        if (def[i]->id == vcpu)
             return def[i];
     }
 
@@ -16727,7 +16726,7 @@ virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
                                          *nvcpupin,
                                          vcpu);
     if (vcpupin) {
-        vcpupin->vcpuid = vcpu;
+        vcpupin->id = vcpu;
         virBitmapFree(vcpupin->cpumask);
         vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
         if (!vcpupin->cpumask)
@@ -16741,7 +16740,7 @@ virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
     if (VIR_ALLOC(vcpupin) < 0)
         goto error;
 
-    vcpupin->vcpuid = vcpu;
+    vcpupin->id = vcpu;
     vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
     if (!vcpupin->cpumask)
         goto error;
@@ -16763,7 +16762,7 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
     virDomainPinDefPtr *vcpupin_list = def->cputune.vcpupin;
 
     for (n = 0; n < def->cputune.nvcpupin; n++) {
-        if (vcpupin_list[n]->vcpuid == vcpu) {
+        if (vcpupin_list[n]->id == vcpu) {
             virBitmapFree(vcpupin_list[n]->cpumask);
             VIR_FREE(vcpupin_list[n]);
             VIR_DELETE_ELEMENT(def->cputune.vcpupin, n, def->cputune.nvcpupin);
@@ -16784,7 +16783,7 @@ virDomainEmulatorPinAdd(virDomainDefPtr def,
         if (VIR_ALLOC(emulatorpin) < 0)
             return -1;
 
-        emulatorpin->vcpuid = -1;
+        emulatorpin->id = -1;
         emulatorpin->cpumask = virBitmapNewData(cpumap, maplen);
         if (!emulatorpin->cpumask) {
             virDomainVcpuPinDefFree(emulatorpin);
@@ -16833,7 +16832,7 @@ virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
                                              *niothreadspin,
                                              iothread_id);
     if (iothreadpin) {
-        iothreadpin->vcpuid = iothread_id;
+        iothreadpin->id = iothread_id;
         virBitmapFree(iothreadpin->cpumask);
         iothreadpin->cpumask = virBitmapNewData(cpumap, maplen);
         if (!iothreadpin->cpumask)
@@ -16847,7 +16846,7 @@ virDomainIOThreadsPinAdd(virDomainPinDefPtr **iothreadspin_list,
     if (VIR_ALLOC(iothreadpin) < 0)
         goto error;
 
-    iothreadpin->vcpuid = iothread_id;
+    iothreadpin->id = iothread_id;
     iothreadpin->cpumask = virBitmapNewData(cpumap, maplen);
     if (!iothreadpin->cpumask)
         goto error;
@@ -16870,7 +16869,7 @@ virDomainIOThreadsPinDel(virDomainDefPtr def,
     virDomainPinDefPtr *iothreadspin_list = def->cputune.iothreadspin;
 
     for (i = 0; i < def->cputune.niothreadspin; i++) {
-        if (iothreadspin_list[i]->vcpuid == iothread_id) {
+        if (iothreadspin_list[i]->id == iothread_id) {
             virBitmapFree(iothreadspin_list[i]->cpumask);
             VIR_DELETE_ELEMENT(def->cputune.iothreadspin, i,
                                def->cputune.niothreadspin);
@@ -20042,7 +20041,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             continue;
 
         virBufferAsprintf(buf, "<vcpupin vcpu='%u' ",
-                          def->cputune.vcpupin[i]->vcpuid);
+                          def->cputune.vcpupin[i]->id);
 
         if (!(cpumask = virBitmapFormat(def->cputune.vcpupin[i]->cpumask)))
             goto error;
@@ -20069,7 +20068,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             continue;
 
         virBufferAsprintf(buf, "<iothreadpin iothread='%u' ",
-                          def->cputune.iothreadspin[i]->vcpuid);
+                          def->cputune.iothreadspin[i]->id);
 
         if (!(cpumask = virBitmapFormat(def->cputune.iothreadspin[i]->cpumask)))
             goto error;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 811a2ab..f7f1146 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1899,7 +1899,7 @@ struct _virDomainClockDef {
 typedef struct _virDomainPinDef virDomainPinDef;
 typedef virDomainPinDef *virDomainPinDefPtr;
 struct _virDomainPinDef {
-    int vcpuid;
+    int id;
     virBitmapPtr cpumask;
 };
 
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 66ca988..407a9bd 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1084,7 +1084,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
     cpumaplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo));
 
     for (vcpu = 0; vcpu < def->cputune.nvcpupin; ++vcpu) {
-        if (vcpu != def->cputune.vcpupin[vcpu]->vcpuid)
+        if (vcpu != def->cputune.vcpupin[vcpu]->id)
             continue;
 
         if (VIR_ALLOC_N(cpumap, cpumaplen) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 60a27f9..97ef2c9 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2095,7 +2095,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
     /* if vcpupin setting exists, there may be unused pcpus */
     for (n = 0; n < targetDef->cputune.nvcpupin; n++) {
         vcpupin_list = targetDef->cputune.vcpupin;
-        vcpu = vcpupin_list[n]->vcpuid;
+        vcpu = vcpupin_list[n]->id;
         cpumask = vcpupin_list[n]->cpumask;
         cpumap = VIR_GET_CPUMAP(cpumaps, maplen, vcpu);
         for (pcpu = 0; pcpu < maxcpu; pcpu++) {
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 260c3c5..3e30767 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -948,7 +948,7 @@ qemuSetupCgroupVcpuPin(virCgroupPtr cgroup,
     size_t i;
 
     for (i = 0; i < nvcpupin; i++) {
-        if (vcpuid == vcpupin[i]->vcpuid)
+        if (vcpuid == vcpupin[i]->id)
             return qemuSetupCgroupEmulatorPin(cgroup, vcpupin[i]->cpumask);
     }
 
@@ -964,7 +964,7 @@ qemuSetupCgroupIOThreadsPin(virCgroupPtr cgroup,
     size_t i;
 
     for (i = 0; i < niothreadspin; i++) {
-        if (iothreadid == iothreadspin[i]->vcpuid)
+        if (iothreadid == iothreadspin[i]->id)
             return qemuSetupCgroupEmulatorPin(cgroup, iothreadspin[i]->cpumask);
     }
 
@@ -1059,7 +1059,7 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
             /* find the right CPU to pin, otherwise
              * qemuSetupCgroupVcpuPin will fail. */
             for (j = 0; j < def->cputune.nvcpupin; j++) {
-                if (def->cputune.vcpupin[j]->vcpuid != i)
+                if (def->cputune.vcpupin[j]->id != i)
                     continue;
 
                 if (qemuSetupCgroupVcpuPin(cgroup_vcpu,
@@ -1236,7 +1236,7 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm)
              * qemuSetupCgroupIOThreadsPin will fail. */
             for (j = 0; j < def->cputune.niothreadspin; j++) {
                 /* IOThreads are numbered/named 1..n */
-                if (def->cputune.iothreadspin[j]->vcpuid != i + 1)
+                if (def->cputune.iothreadspin[j]->id != i + 1)
                     continue;
 
                 if (qemuSetupCgroupIOThreadsPin(cgroup_iothread,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 01f92be..94221fb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4606,7 +4606,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
 
                 vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
                 virBitmapCopy(vcpupin->cpumask, vm->def->cpumask);
-                vcpupin->vcpuid = i;
+                vcpupin->id = i;
                 if (VIR_APPEND_ELEMENT_COPY(vm->def->cputune.vcpupin,
                                             vm->def->cputune.nvcpupin, vcpupin) < 0) {
                     virBitmapFree(vcpupin->cpumask);
-- 
2.1.0

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]