[libvirt] [PATCH v1 09/11] storagePoolCreateXML: Don't lose persistent storage on failed create

Michal Privoznik mprivozn at redhat.com
Fri May 24 14:35:45 UTC 2019


If there's a persistent storage and user tries to start a new one
with the same name and UUID (e.g. to test new configuration) it
may happen that upon failure we lose the persistent defintion.
Fortunately, we don't remove it from the disk only from the
internal list of the pools.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/storage/storage_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 38b83a77b7..def4123b82 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -744,6 +744,7 @@ storagePoolCreateXML(virConnectPtr conn,
         goto cleanup;
 
     if (!(obj = virStoragePoolObjListAdd(driver->pools, newDef,
+                                         VIR_STORAGE_POOL_OBJ_LIST_ADD_LIVE |
                                          VIR_STORAGE_POOL_OBJ_LIST_ADD_CHECK_LIVE)))
         goto cleanup;
     newDef = NULL;
@@ -790,7 +791,7 @@ storagePoolCreateXML(virConnectPtr conn,
     return pool;
 
  error:
-    virStoragePoolObjRemove(driver->pools, obj);
+    virStoragePoolUpdateInactive(obj);
     goto cleanup;
 }
 
-- 
2.21.0




More information about the libvir-list mailing list