Blame SOURCES/libvirt-storage-Revert-volume-obj-list-updating-after-volume-creation-4749d82a.patch

7a3408
From dc0160fb18c2bd936a0751b9d18dd0c4f81c068a Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <dc0160fb18c2bd936a0751b9d18dd0c4f81c068a@dist-git>
7a3408
From: Erik Skultety <eskultet@redhat.com>
7a3408
Date: Thu, 9 Jul 2015 15:11:57 +0200
7a3408
Subject: [PATCH] storage: Revert volume obj list updating after volume
7a3408
 creation (4749d82a)
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1241454
7a3408
7a3408
This patch reverts commit 4749d82a which tried to tweak the logic in
7a3408
volume creation. We did realloc and update our object list before we executed
7a3408
volume building within a specific storage backend. If that failed, we
7a3408
had to update (again) our object list to the original state as it was before the
7a3408
build and delete the volume from the pool (even though it didn't exist - this
7a3408
truly depends on the backend).
7a3408
I misunderstood the base idea to be able to poll the status of the volume
7a3408
creation using vol-info. After commit 4749d82a this wasn't possible
7a3408
anymore, although no BZ has been reported yet.
7a3408
7a3408
Commit 4749d82a also claimed to fix
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1223177, but commit c8be606b of the
7a3408
same series as 4749d82ad (which was more of a refactor than a fix)
7a3408
fixes the same issue so the revert should be pretty straightforward.
7a3408
Further more, BZ https://bugzilla.redhat.com/show_bug.cgi?id=1241454 can be
7a3408
fixed with this revert.
7a3408
7a3408
(cherry picked from commit b5637871920c88d88a32343a13c6c1476062a6bb)
7a3408
Signed-off-by: Erik Skultety <eskultet@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/storage/storage_driver.c | 28 ++++++++++++++++++----------
7a3408
 1 file changed, 18 insertions(+), 10 deletions(-)
7a3408
7a3408
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
7a3408
index d3cdbc5..b67a5d8 100644
7a3408
--- a/src/storage/storage_driver.c
7a3408
+++ b/src/storage/storage_driver.c
7a3408
@@ -1803,6 +1803,9 @@ storageVolCreateXML(virStoragePoolPtr obj,
7a3408
         goto cleanup;
7a3408
     }
7a3408
 
7a3408
+    if (VIR_REALLOC_N(pool->volumes.objs,
7a3408
+                      pool->volumes.count+1) < 0)
7a3408
+        goto cleanup;
7a3408
 
7a3408
     if (!backend->createVol) {
7a3408
         virReportError(VIR_ERR_NO_SUPPORT,
7a3408
@@ -1817,6 +1820,14 @@ storageVolCreateXML(virStoragePoolPtr obj,
7a3408
     if (backend->createVol(obj->conn, pool, voldef) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
+    pool->volumes.objs[pool->volumes.count++] = voldef;
7a3408
+    volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
7a3408
+                              voldef->key, NULL, NULL);
7a3408
+    if (!volobj) {
7a3408
+        pool->volumes.count--;
7a3408
+        goto cleanup;
7a3408
+    }
7a3408
+
7a3408
     if (VIR_ALLOC(buildvoldef) < 0) {
7a3408
         voldef = NULL;
7a3408
         goto cleanup;
7a3408
@@ -1845,19 +1856,16 @@ storageVolCreateXML(virStoragePoolPtr obj,
7a3408
         voldef->building = false;
7a3408
         pool->asyncjobs--;
7a3408
 
7a3408
-        if (buildret < 0)
7a3408
+        if (buildret < 0) {
7a3408
+            VIR_FREE(buildvoldef);
7a3408
+            storageVolDeleteInternal(volobj, backend, pool, voldef,
7a3408
+                                     0, false);
7a3408
+            voldef = NULL;
7a3408
             goto cleanup;
7a3408
+        }
7a3408
+
7a3408
     }
7a3408
 
7a3408
-    if (VIR_REALLOC_N(pool->volumes.objs,
7a3408
-                      pool->volumes.count+1) < 0)
7a3408
-        goto cleanup;
7a3408
-
7a3408
-    pool->volumes.objs[pool->volumes.count++] = voldef;
7a3408
-    if (!(volobj = virGetStorageVol(obj->conn, pool->def->name, voldef->name,
7a3408
-                                    voldef->key, NULL, NULL)))
7a3408
-        goto cleanup;
7a3408
-
7a3408
     if (backend->refreshVol &&
7a3408
         backend->refreshVol(obj->conn, pool, voldef) < 0)
7a3408
         goto cleanup;
7a3408
-- 
7a3408
2.4.5
7a3408