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

Michal Privoznik posted 11 patches 5 years, 6 months ago
[libvirt] [PATCH v1 09/11] storagePoolCreateXML: Don't lose persistent storage on failed create
Posted by Michal Privoznik 5 years, 6 months ago
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>
---
 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
Re: [libvirt] [PATCH v1 09/11] storagePoolCreateXML: Don't lose persistent storage on failed create
Posted by Ján Tomko 5 years, 3 months ago
On Fri, May 24, 2019 at 04:35:45PM +0200, Michal Privoznik wrote:
>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>
>---
> src/storage/storage_driver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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