]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storagePoolCreateXML: Don't lose persistent storage on failed create
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 May 2019 14:35:45 +0000 (16:35 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Aug 2019 15:09:05 +0000 (17:09 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/storage/storage_driver.c

index f2ecabc70f576f99f0e4aa5420389ae17a856544..ebf3f78752949ae9e2033e674014e5c01dc5f420 100644 (file)
@@ -755,6 +755,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;
@@ -801,7 +802,7 @@ storagePoolCreateXML(virConnectPtr conn,
     return pool;
 
  error:
-    virStoragePoolObjRemove(driver->pools, obj);
+    virStoragePoolUpdateInactive(obj);
     goto cleanup;
 }