[libvirt] [PATCH 1/3] storage: Need to clear pool prior to calling the refreshPool

John Ferlan jferlan at redhat.com
Tue May 10 13:26:40 UTC 2016


Prior to calling the 'refreshPool' during CreatePool or UploadPool
operations, we need to clear the pool; otherwise, the pool will
have duplicated entries.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 1d42f24..bf05b19 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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)
@@ -2356,6 +2358,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)
-- 
2.5.5




More information about the libvir-list mailing list