Blob Blame History Raw
From 804758be414002c97bd12dd03ec26cd867771185 Mon Sep 17 00:00:00 2001
Message-Id: <804758be414002c97bd12dd03ec26cd867771185@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Fri, 5 Aug 2016 09:44:05 -0400
Subject: [PATCH] storage: Don't remove the pool for buildPool failure in
 storagePoolCreate

https://bugzilla.redhat.com/show_bug.cgi?id=1362349

When adding the ability to build the pool during the start pool processing
using the similar flags as buildPool processing would use, the code was
essentially cut-n-pasted from storagePoolCreateXML.  However, that included
a call to virStoragePoolObjRemove which shouldn't happen within the
storagePoolCreate path since that'll remove the pool from the list of
pools only to be rediscovered if libvirtd restarts.

So on failure, just fail and return as we should expect

(cherry picked from commit fbfd6f2103a56df73238b023032dfb1242a4d7d5)
Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/storage/storage_driver.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index cb9d578..5d26109 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -931,11 +931,8 @@ storagePoolCreate(virStoragePoolPtr obj,
 
         if (build_flags ||
             (flags & VIR_STORAGE_POOL_CREATE_WITH_BUILD)) {
-            if (backend->buildPool(obj->conn, pool, build_flags) < 0) {
-                virStoragePoolObjRemove(&driver->pools, pool);
-                pool = NULL;
+            if (backend->buildPool(obj->conn, pool, build_flags) < 0)
                 goto cleanup;
-            }
         }
     }
 
-- 
2.9.2