]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
test: Don't overwrite storage volume target path and key
authorMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 8 Sep 2010 19:46:15 +0000 (21:46 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 9 Sep 2010 20:05:47 +0000 (22:05 +0200)
Only generate target path and key when they are not defined
in the XML config.

src/test/test_driver.c

index 6c06cbc2730d85eb18b80b12861fb6a89ec2fbc7..9d223392f2a4f137ab0ecbcac574a7b5a05a378a 100644 (file)
@@ -706,17 +706,21 @@ static int testOpenVolumesForPool(xmlDocPtr xml,
             goto error;
         }
 
-        if (virAsprintf(&def->target.path, "%s/%s",
-                        pool->def->target.path,
-                        def->name) == -1) {
-            virReportOOMError();
-            goto error;
+        if (def->target.path == NULL) {
+            if (virAsprintf(&def->target.path, "%s/%s",
+                            pool->def->target.path,
+                            def->name) == -1) {
+                virReportOOMError();
+                goto error;
+            }
         }
 
-        def->key = strdup(def->target.path);
         if (def->key == NULL) {
-            virReportOOMError();
-            goto error;
+            def->key = strdup(def->target.path);
+            if (def->key == NULL) {
+                virReportOOMError();
+                goto error;
+            }
         }
 
         pool->def->allocation += def->allocation;