[PATCH RFC 18/27] storage: Introduce internal pool support

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

 



To allow using the storage driver APIs to do operation on generic domain
disks we will need to introduce internal storage pools that will give is
a base to support this stuff even on files that weren't originally
defined as a part of the pool.

This patch introduces the 'internal' flag for a storage pool that will
prevent it from being listed along with the user defined storage pools.
---
 src/conf/storage_conf.c      |  3 +++
 src/conf/storage_conf.h      |  1 +
 src/storage/storage_driver.c | 12 ++++++++----
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index ed492cf..379bbd6 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2172,6 +2172,9 @@ static bool
 virStoragePoolMatch(virStoragePoolObjPtr poolobj,
                     unsigned int flags)
 {
+    if (poolobj->internal)
+        return false;
+
     /* filter by active state */
     if (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) &&
         !((MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE) &&
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 485bdba..62ac749 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -332,6 +332,7 @@ struct _virStoragePoolObj {
     int active;
     int autostart;
     unsigned int asyncjobs;
+    bool internal;

     virStoragePoolDefPtr def;
     virStoragePoolDefPtr newDef;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 8b1dcae..00f2c50 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -377,7 +377,8 @@ storageConnectNumOfStoragePools(virConnectPtr conn) {
         virStoragePoolObjPtr obj = driver->pools.objs[i];
         virStoragePoolObjLock(obj);
         if (virConnectNumOfStoragePoolsCheckACL(conn, obj->def) &&
-            virStoragePoolObjIsActive(obj))
+            virStoragePoolObjIsActive(obj) &&
+            !obj->internal)
             nactive++;
         virStoragePoolObjUnlock(obj);
     }
@@ -402,7 +403,8 @@ storageConnectListStoragePools(virConnectPtr conn,
         virStoragePoolObjPtr obj = driver->pools.objs[i];
         virStoragePoolObjLock(obj);
         if (virConnectListStoragePoolsCheckACL(conn, obj->def) &&
-            virStoragePoolObjIsActive(obj)) {
+            virStoragePoolObjIsActive(obj) &&
+            !obj->internal) {
             if (VIR_STRDUP(names[got], obj->def->name) < 0) {
                 virStoragePoolObjUnlock(obj);
                 goto cleanup;
@@ -436,7 +438,8 @@ storageConnectNumOfDefinedStoragePools(virConnectPtr conn) {
         virStoragePoolObjPtr obj = driver->pools.objs[i];
         virStoragePoolObjLock(obj);
         if (virConnectNumOfDefinedStoragePoolsCheckACL(conn, obj->def) &&
-            !virStoragePoolObjIsActive(obj))
+            !virStoragePoolObjIsActive(obj) &&
+            !obj->internal)
             nactive++;
         virStoragePoolObjUnlock(obj);
     }
@@ -461,7 +464,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn,
         virStoragePoolObjPtr obj = driver->pools.objs[i];
         virStoragePoolObjLock(obj);
         if (virConnectListDefinedStoragePoolsCheckACL(conn, obj->def) &&
-            !virStoragePoolObjIsActive(obj)) {
+            !virStoragePoolObjIsActive(obj) &&
+            !obj->internal) {
             if (VIR_STRDUP(names[got], obj->def->name) < 0) {
                 virStoragePoolObjUnlock(obj);
                 goto cleanup;
-- 
1.8.5.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]