[libvirt] [PATCH 02/50] list: Expose pool type via virStoragePoolGetInfo

Osier Yang jyang at redhat.com
Thu Jul 19 16:40:33 UTC 2012


Mainly for later patches' use, to filter the pools by pool type.

include/libvirt/libvirt.h.in: Add enum virStoragePoolType; Add
pool type to virStoragePoolInfo.

src/conf/storage_conf.h: Remove enum virStoragePoolType.

src/storage/storage_driver.c: Expose pool type via storagePoolGetInfo.
---
 include/libvirt/libvirt.h.in |   17 +++++++++++++++++
 src/conf/storage_conf.h      |   19 -------------------
 src/storage/storage_driver.c |    2 ++
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index e34438c..2820b2a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2335,6 +2335,22 @@ typedef struct _virStoragePool virStoragePool;
  */
 typedef virStoragePool *virStoragePoolPtr;
 
+typedef enum {
+    VIR_STORAGE_POOL_DIR,      /* Local directory */
+    VIR_STORAGE_POOL_FS,       /* Local filesystem */
+    VIR_STORAGE_POOL_NETFS,    /* Networked filesystem - eg NFS, GFS, etc */
+    VIR_STORAGE_POOL_LOGICAL,  /* Logical volume groups / volumes */
+    VIR_STORAGE_POOL_DISK,     /* Disk partitions */
+    VIR_STORAGE_POOL_ISCSI,    /* iSCSI targets */
+    VIR_STORAGE_POOL_SCSI,     /* SCSI HBA */
+    VIR_STORAGE_POOL_MPATH,    /* Multipath devices */
+    VIR_STORAGE_POOL_RBD,      /* RADOS Block Device */
+    VIR_STORAGE_POOL_SHEEPDOG, /* Sheepdog device */
+
+#ifdef VIR_ENUM_SENTINELS
+    VIR_STORAGE_POOL_LAST,
+#endif
+} virStoragePoolType;
 
 typedef enum {
     VIR_STORAGE_POOL_INACTIVE = 0, /* Not running */
@@ -2365,6 +2381,7 @@ typedef enum {
 typedef struct _virStoragePoolInfo virStoragePoolInfo;
 
 struct _virStoragePoolInfo {
+  int type;                      /* virStoragePoolType */
   int state;                     /* virStoragePoolState flags */
   unsigned long long capacity;   /* Logical size bytes */
   unsigned long long allocation; /* Current allocation bytes */
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 6f84340..f395279 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -107,25 +107,6 @@ struct _virStorageVolDefList {
     virStorageVolDefPtr *objs;
 };
 
-
-
-/* Storage pools */
-
-enum virStoragePoolType {
-    VIR_STORAGE_POOL_DIR,      /* Local directory */
-    VIR_STORAGE_POOL_FS,       /* Local filesystem */
-    VIR_STORAGE_POOL_NETFS,    /* Networked filesystem - eg NFS, GFS, etc */
-    VIR_STORAGE_POOL_LOGICAL,  /* Logical volume groups / volumes */
-    VIR_STORAGE_POOL_DISK,     /* Disk partitions */
-    VIR_STORAGE_POOL_ISCSI,    /* iSCSI targets */
-    VIR_STORAGE_POOL_SCSI,     /* SCSI HBA */
-    VIR_STORAGE_POOL_MPATH,    /* Multipath devices */
-    VIR_STORAGE_POOL_RBD,      /* RADOS Block Device */
-    VIR_STORAGE_POOL_SHEEPDOG, /* Sheepdog device */
-
-    VIR_STORAGE_POOL_LAST,
-};
-
 VIR_ENUM_DECL(virStoragePool)
 
 enum virStoragePoolDeviceType {
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index c9b8021..39dc13b 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -939,6 +939,8 @@ storagePoolGetInfo(virStoragePoolPtr obj,
         goto cleanup;
 
     memset(info, 0, sizeof(virStoragePoolInfo));
+
+    info->type = pool->def->type;
     if (pool->active)
         info->state = VIR_STORAGE_POOL_RUNNING;
     else
-- 
1.7.7.3




More information about the libvir-list mailing list