[libvirt] [PATCH 15/16] conf: Simplify cputune parameter retrieval

Peter Krempa pkrempa at redhat.com
Wed Feb 20 17:06:49 UTC 2013


The parameters are initialized already so no need to do it again.
---
 src/conf/domain_conf.c | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3c3172d..da04b7b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9485,29 +9485,16 @@ virDomainDefParseXML(virCapsPtr caps,
     }

     /* Extract cpu tunables. */
-    if (virXPathULong("string(./cputune/shares[1])", ctxt,
-                      &def->cputune.shares) < 0)
-        def->cputune.shares = 0;
+    virXPathULong("string(./cputune/shares[1])", ctxt, &def->cputune.shares);
+    virXPathULongLong("string(./cputune/period[1])", ctxt, &def->cputune.period);
+    virXPathLongLong("string(./cputune/quota[1])", ctxt, &def->cputune.quota);
+    virXPathULongLong("string(./cputune/emulator_period[1])", ctxt,
+                      &def->cputune.emulator_period);
+    virXPathLongLong("string(./cputune/emulator_quota[1])", ctxt,
+                     &def->cputune.emulator_quota);

-    if (virXPathULongLong("string(./cputune/period[1])", ctxt,
-                          &def->cputune.period) < 0)
-        def->cputune.period = 0;
-
-    if (virXPathLongLong("string(./cputune/quota[1])", ctxt,
-                         &def->cputune.quota) < 0)
-        def->cputune.quota = 0;
-
-    if (virXPathULongLong("string(./cputune/emulator_period[1])", ctxt,
-                          &def->cputune.emulator_period) < 0)
-        def->cputune.emulator_period = 0;
-
-    if (virXPathLongLong("string(./cputune/emulator_quota[1])", ctxt,
-                         &def->cputune.emulator_quota) < 0)
-        def->cputune.emulator_quota = 0;
-
-    if ((n = virXPathNodeSet("./cputune/vcpupin", ctxt, &nodes)) < 0) {
+    if ((n = virXPathNodeSet("./cputune/vcpupin", ctxt, &nodes)) < 0)
         goto error;
-    }

     if (n && VIR_ALLOC_N(def->cputune.vcpupin, n) < 0)
         goto no_memory;
-- 
1.8.1.1




More information about the libvir-list mailing list