[PATCH 2/3] Make virDomainVcpuPinDel return void

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

 



Before, it only returned -1 on failure to shrink the array.
Since the switch to VIR_DELETE_ELEMENT in commit 2133441,
it returns either 0 or 0.
---
 src/conf/domain_conf.c   | 11 ++---------
 src/conf/domain_conf.h   |  2 +-
 src/libxl/libxl_driver.c |  7 +------
 src/qemu/qemu_driver.c   | 16 +++-------------
 4 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cb0df3d..57eb215 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14510,27 +14510,20 @@ virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
     return -1;
 }
 
-int
+void
 virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
 {
     int n;
     virDomainVcpuPinDefPtr *vcpupin_list = def->cputune.vcpupin;
 
-    /* No vcpupin exists yet */
-    if (!def->cputune.nvcpupin) {
-        return 0;
-    }
-
     for (n = 0; n < def->cputune.nvcpupin; n++) {
         if (vcpupin_list[n]->vcpuid == vcpu) {
             virBitmapFree(vcpupin_list[n]->cpumask);
             VIR_FREE(vcpupin_list[n]);
             VIR_DELETE_ELEMENT(vcpupin_list, n, def->cputune.nvcpupin);
-            break;
+            return;
         }
     }
-
-    return 0;
 }
 
 int
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3426c48..c1cc854 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2300,7 +2300,7 @@ int virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
                         int maplen,
                         int vcpu);
 
-int virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
+void virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
 
 int virDomainEmulatorPinAdd(virDomainDefPtr def,
                               unsigned char *cpumap,
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index b3f8df6..a6ae8a1 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1945,12 +1945,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
 
     /* full bitmap means reset the settings (if any). */
     if (virBitmapIsAllSet(pcpumap)) {
-        if (virDomainVcpuPinDel(targetDef, vcpu) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to delete vcpupin xml for vcpu '%d'"),
-                           vcpu);
-            goto endjob;
-        }
+        virDomainVcpuPinDel(targetDef, vcpu);
         goto done;
     }
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3fbaa62..6996b80 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4130,7 +4130,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
             }
 
             /* Free vcpupin setting */
-            ignore_value(virDomainVcpuPinDel(vm->def, i));
+            virDomainVcpuPinDel(vm->def, i);
         }
     }
 
@@ -4423,12 +4423,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
         }
 
         if (doReset) {
-            if (virDomainVcpuPinDel(vm->def, vcpu) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("failed to delete vcpupin xml of "
-                                 "a running domain"));
-                goto cleanup;
-            }
+            virDomainVcpuPinDel(vm->def, vcpu);
         } else {
             if (vm->def->cputune.vcpupin)
                 virDomainVcpuPinDefArrayFree(vm->def->cputune.vcpupin, vm->def->cputune.nvcpupin);
@@ -4448,12 +4443,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
 
         if (doReset) {
-            if (virDomainVcpuPinDel(persistentDef, vcpu) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                               _("failed to delete vcpupin xml of "
-                                 "a persistent domain"));
-                goto cleanup;
-            }
+            virDomainVcpuPinDel(persistentDef, vcpu);
         } else {
             if (!persistentDef->cputune.vcpupin) {
                 if (VIR_ALLOC(persistentDef->cputune.vcpupin) < 0)
-- 
1.8.3.2

--
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]