[PATCH 3/3] Delete vol while the vol is building

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/storage/storage_driver.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d1fef92..61048ce 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1350,6 +1350,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
         storageDriverUnlock(driver);
 
         voldef->building = 0;
+        virCondBroadcast(&pool->cond);
         pool->asyncjobs--;
 
         voldef = NULL;
@@ -1508,6 +1509,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
 
     origvol->building = 0;
     newvol->building = 0;
+    virCondBroadcast(&pool->cond);
+    virCondBroadcast(&origpool->cond);
     newvol = NULL;
     pool->asyncjobs--;
 
@@ -1912,12 +1915,20 @@ storageVolumeDelete(virStorageVolPtr obj,
     }
 
     if (vol->building) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                              _("volume '%s' is still being allocated."),
-                              vol->name);
-        goto cleanup;
+        if (vol->type == VIR_STORAGE_VOL_FILE) {
+            goto deletevol;
+        } else if (vol->type == VIR_STORAGE_VOL_BLOCK) {
+            while(vol->building){
+                if (virCondWait(&pool->cond, &pool->lock) < 0){
+                    virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                          _("unable to wait on storage condition"));
+                    goto cleanup;
+                }
+            }
+        }
     }
 
+deletevol:
     if (!backend->deleteVol) {
         virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support vol deletion"));
-- 
1.7.1

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]