[libvirt] [PATCH 1/3] Add 'asyncjobs' counter to storage pool

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

 



Add an 'asyncjobs' counter to the storage pool definition. The counter
tracks how many nonblocking jobs the pool is currently running, and
prevents the operations destroy, refresh, undefine, and delete.

Will be used for non-blocking volume creation.

- Cole
diff --git a/src/storage_conf.h b/src/storage_conf.h
index 4e35ccb..9c9fd3e 100644
--- a/src/storage_conf.h
+++ b/src/storage_conf.h
@@ -238,6 +238,7 @@ struct _virStoragePoolObj {
     char *autostartLink;
     int active;
     int autostart;
+    unsigned int asyncjobs;
 
     virStoragePoolDefPtr def;
     virStoragePoolDefPtr newDef;
diff --git a/src/storage_driver.c b/src/storage_driver.c
index 97fcf69..8759ab2 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -564,6 +564,13 @@ storagePoolUndefine(virStoragePoolPtr obj) {
         goto cleanup;
     }
 
+    if (pool->asyncjobs > 0) {
+        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+                              _("pool '%s' has asynchronous jobs running."),
+                              pool->def->name);
+        goto cleanup;
+    }
+
     if (virStoragePoolObjDeleteDef(obj->conn, pool) < 0)
         goto cleanup;
 
@@ -696,6 +703,13 @@ storagePoolDestroy(virStoragePoolPtr obj) {
         goto cleanup;
     }
 
+    if (pool->asyncjobs > 0) {
+        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+                              _("pool '%s' has asynchronous jobs running."),
+                              pool->def->name);
+        goto cleanup;
+    }
+
     if (backend->stopPool &&
         backend->stopPool(obj->conn, pool) < 0)
         goto cleanup;
@@ -745,6 +759,13 @@ storagePoolDelete(virStoragePoolPtr obj,
         goto cleanup;
     }
 
+    if (pool->asyncjobs > 0) {
+        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+                              _("pool '%s' has asynchronous jobs running."),
+                              pool->def->name);
+        goto cleanup;
+    }
+
     if (!backend->deletePool) {
         virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
                               "%s", _("pool does not support volume delete"));
@@ -788,6 +809,13 @@ storagePoolRefresh(virStoragePoolPtr obj,
         goto cleanup;
     }
 
+    if (pool->asyncjobs > 0) {
+        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+                              _("pool '%s' has asynchronous jobs running."),
+                              pool->def->name);
+        goto cleanup;
+    }
+
     virStoragePoolObjClearVols(pool);
     if (backend->refreshPool(obj->conn, pool) < 0) {
         if (backend->stopPool)
--
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]