]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Need to clear pool prior to calling the refreshPool
authorJohn Ferlan <jferlan@redhat.com>
Tue, 26 Apr 2016 12:19:07 +0000 (08:19 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 11 May 2016 13:23:31 +0000 (09:23 -0400)
Prior to calling the 'refreshPool' during CreatePool or UploadPool
operations, we need to clear the pool; otherwise, the pool will
have duplicated entries.

src/storage/storage_driver.c

index ae6a511a132d1930afd81025f448de3149d33f2f..5dffcc8651b434fb2548b45644b933e1834577ab 100644 (file)
@@ -727,6 +727,7 @@ storagePoolCreateXML(virConnectPtr conn,
     stateFile = virFileBuildPath(driver->stateDir,
                                  pool->def->name, ".xml");
 
+    virStoragePoolObjClearVols(pool);
     if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
         backend->refreshPool(conn, pool) < 0) {
         if (stateFile)
@@ -918,6 +919,7 @@ storagePoolCreate(virStoragePoolPtr obj,
     stateFile = virFileBuildPath(driver->stateDir,
                                  pool->def->name, ".xml");
 
+    virStoragePoolObjClearVols(pool);
     if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
         backend->refreshPool(obj->conn, pool) < 0) {
         if (stateFile)
@@ -2363,6 +2365,7 @@ storageVolUpload(virStorageVolPtr obj,
      * interaction and we can just lookup the backend in the callback
      * routine in order to call the refresh API.
      */
+    virStoragePoolObjClearVols(pool);
     if (backend->refreshPool) {
         if (VIR_ALLOC(cbdata) < 0 ||
             VIR_STRDUP(cbdata->pool_name, pool->def->name) < 0)