[PATCH 03/19] test: Rename @vol to @volDef in testOpenVolumesForPool

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

 



Make it more obvious as we're about to need to change how
obj->def gets referenced.

Perform a couple of minor cleanups along the way too.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/test/test_driver.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index aacb513d6..07eb9d628 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1050,7 +1050,7 @@ testOpenVolumesForPool(const char *file,
     size_t i;
     int num, ret = -1;
     xmlNodePtr *nodes = NULL;
-    virStorageVolDefPtr def = NULL;
+    virStorageVolDefPtr volDef = NULL;
 
     /* Find storage volumes */
     if (virAsprintf(&vol_xpath, "/node/pool[%d]/volume", objidx) < 0)
@@ -1067,30 +1067,29 @@ testOpenVolumesForPool(const char *file,
         if (!node)
             goto error;
 
-        def = virStorageVolDefParseNode(obj->def, ctxt->doc, node, 0);
-        if (!def)
+        if (!(volDef = virStorageVolDefParseNode(obj->def, ctxt->doc, node, 0)))
             goto error;
 
-        if (def->target.path == NULL) {
-            if (virAsprintf(&def->target.path, "%s/%s",
-                            obj->def->target.path, def->name) < 0)
+        if (!volDef->target.path) {
+            if (virAsprintf(&volDef->target.path, "%s/%s",
+                            obj->def->target.path, volDef->name) < 0)
                 goto error;
         }
 
-        if (!def->key && VIR_STRDUP(def->key, def->target.path) < 0)
+        if (!volDef->key && VIR_STRDUP(volDef->key, volDef->target.path) < 0)
             goto error;
 
-        if (virStoragePoolObjAddVol(obj, def) < 0)
+        if (virStoragePoolObjAddVol(obj, volDef) < 0)
             goto error;
 
-        obj->def->allocation += def->target.allocation;
+        obj->def->allocation += volDef->target.allocation;
         obj->def->available = (obj->def->capacity - obj->def->allocation);
-        def = NULL;
+        volDef = NULL;
     }
 
     ret = 0;
  error:
-    virStorageVolDefFree(def);
+    virStorageVolDefFree(volDef);
     VIR_FREE(nodes);
     return ret;
 }
-- 
2.13.5

--
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]
  Powered by Linux