]> xenbits.xensource.com Git - libvirt.git/commitdiff
test: Don't assume a configFile exists for Storage Pool tests
authorJohn Ferlan <jferlan@redhat.com>
Wed, 15 Mar 2017 19:09:35 +0000 (15:09 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 16 Mar 2017 01:23:18 +0000 (21:23 -0400)
Fix a "bug" in the storage pool test driver code which "assumed"
testStoragePoolObjSetDefaults should fill in the configFile for
both the Define/Create (persistent) and CreateXML (transient) pools
by just VIR_FREE()'ing it during CreateXML.  Because the configFile
was filled in, during Destroy the pool wouldn't be free'd which
could cause issues for future patches which add tests to validate
vHBA creation for the storage pool using the same name.

src/test/test_driver.c

index 18792bc974daea6e2427e0703fc5d4d01f1fc9de..102395637c60292fa33cbe59652e3fe567110916 100644 (file)
@@ -4439,6 +4439,12 @@ testStoragePoolCreateXML(virConnectPtr conn,
         pool = NULL;
         goto cleanup;
     }
+
+    /* *SetDefaults fills this in for the persistent pools, but this
+     * would be a transient pool so remove it; otherwise, the Destroy
+     * code will not Remove the pool */
+    VIR_FREE(pool->configFile);
+
     pool->active = 1;
 
     event = virStoragePoolEventLifecycleNew(pool->def->name, pool->def->uuid,