[Libvirt-cim] [PATCH 3 of 3] Expose Path attribute for DiskPools

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Aug 25 15:48:00 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1251155681 25200
# Node ID 9af5eef7ea76c7e9d1657d2e8cd4df9ed126b596
# Parent  5253dd03a6588d6856aa30fdbb385c3325d0fed1
Expose Path attribute for DiskPools

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 5253dd03a658 -r 9af5eef7ea76 schema/DiskPool.mof
--- a/schema/DiskPool.mof	Tue Aug 25 08:45:56 2009 -0700
+++ b/schema/DiskPool.mof	Mon Aug 24 16:14:41 2009 -0700
@@ -3,15 +3,24 @@
 [Provider("cmpi::Virt_DevicePool")]
 class Xen_DiskPool : CIM_ResourcePool
 {
+  [Description("Path this storage pool represents")]
+  string Path;
+
 };
 
 [Provider("cmpi::Virt_DevicePool")]
 class KVM_DiskPool : CIM_ResourcePool
 {
+  [Description("Path this storage pool represents")]
+  string Path;
+
 };
 
 [Provider("cmpi::Virt_DevicePool")]
 class LXC_DiskPool : CIM_ResourcePool
 {
+  [Description("Path this storage pool represents")]
+  string Path;
+
 };
 
diff -r 5253dd03a658 -r 9af5eef7ea76 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Tue Aug 25 08:45:56 2009 -0700
+++ b/src/Virt_DevicePool.c	Mon Aug 24 16:14:41 2009 -0700
@@ -166,6 +166,8 @@
         virStoragePoolInfo info;
         uint64_t cap;
         uint64_t res;
+        struct virt_pool *pool_vals = NULL;
+        const char *pool_str = NULL;
 
         pool = virStoragePoolLookupByName(conn, _pool->tag);
         if (pool == NULL) {
@@ -187,9 +189,21 @@
         CMSetProperty(inst, "Reserved",
                       (CMPIValue *)&res, CMPI_uint64);
 
+        if (get_disk_pool(pool, &pool_vals) != 0) {
+                CU_DEBUG("Error getting pool path for: %s", _pool->tag);
+        } else {
+                if (pool_vals->pool_info.disk.path != NULL) {
+                        pool_str = strdup(pool_vals->pool_info.disk.path);
+
+                        CMSetProperty(inst, "Path",
+                                      (CMPIValue *)pool_str, CMPI_chars);
+                }
+        }
+
         result = true;
  out:
         virStoragePoolFree(pool);
+        cleanup_virt_pool(&pool_vals);
 
         return result;
 }
@@ -305,6 +319,9 @@
         CMSetProperty(inst, "Reserved",
                       (CMPIValue *)&res, CMPI_uint64);
 
+        CMSetProperty(inst, "Path",
+                      (CMPIValue *)pool->path, CMPI_chars);
+
         result = true;
  out:
         return result;




More information about the Libvirt-cim mailing list