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 <mpriv...@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to