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

[libvirt] [PATCH 2/3] Add 'building' field to storage volume definition.



Add 'building' boolean field to storage volume definition.

If marked, the volume cannot be deleted. To be used for non-blocking
volume allocation.

- Cole
diff --git a/src/storage_conf.h b/src/storage_conf.h
index 9c9fd3e..8a4fed2 100644
--- a/src/storage_conf.h
+++ b/src/storage_conf.h
@@ -84,6 +84,8 @@ struct _virStorageVolDef {
     char *key;
     int type; /* virStorageVolType enum */
 
+    unsigned int building;
+
     unsigned long long allocation;
     unsigned long long capacity;
 
diff --git a/src/storage_driver.c b/src/storage_driver.c
index 8759ab2..8cb8d4b 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -1294,6 +1294,13 @@ storageVolumeDelete(virStorageVolPtr obj,
         goto cleanup;
     }
 
+    if (vol->building) {
+        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+                              _("volume '%s' is still being allocated."),
+                              vol->name);
+        goto cleanup;
+    }
+
     if (!backend->deleteVol) {
         virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support vol deletion"));

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