From 9342bc626b040d2d7bc45e7e9987b1f756c1ca34 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 24 May 2019 16:35:45 +0200 Subject: [PATCH] storagePoolCreateXML: Don't lose persistent storage on failed create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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 f2ecabc70f..ebf3f78752 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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; } -- GitLab