[Libvirt-cim] [PATCH 3 of 3] Add support for logical storage pools

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Jun 19 22:33:24 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1245113103 25200
# Node ID 82ac631405db90dd06173329df74ed90789660ee
# Parent  95e453b65affa4eb77bedfab60c954283e34f0ad
Add support for logical storage pools

Note:  These changes don't add support for creating the volume group (in the
case where one doesn't already exist).  That functionality will be added in
a later patch.  This means you will need an existing volume group already
defined in order to test.

For now, you can create a volume pool just by specifying the following
attributes:
  -Type and Path (in the DiskPoolRASD)
  -ElementName (param of the CreateChildResourcePool() method).

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

diff -r 95e453b65aff -r 82ac631405db src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c	Mon Jun 15 17:26:12 2009 -0700
+++ b/src/Virt_ResourcePoolConfigurationService.c	Mon Jun 15 17:45:03 2009 -0700
@@ -189,20 +189,28 @@
         return NULL;
 }
 
-static const char *disk_fs_or_disk_pool(CMPIInstance *inst,
-                                        struct virt_pool *pool)
+static const char *disk_fs_or_disk_or_logical_pool(CMPIInstance *inst,
+                                                   struct virt_pool *pool)
 {
         const char *msg = NULL;
 
         msg = get_dev_paths(inst, 
                             &pool->pool_info.disk.device_paths, 
                             &pool->pool_info.disk.device_paths_ct);
-        
-        if (msg != NULL)
-                return msg;
 
-        if (pool->pool_info.disk.device_paths_ct != 1)
-                return "Specified pool type only takes one device path";
+
+        /* Specifying a value for DevicePaths isn't mandatory for logical
+           pool types.  */ 
+        if (pool->pool_info.disk.pool_type != DISK_POOL_LOGICAL) {
+                if (msg != NULL)
+                        return msg;
+
+                if (pool->pool_info.disk.device_paths_ct != 1) {
+                        CU_DEBUG("%d only takes one device path", 
+                                 pool->pool_info.disk.pool_type);
+                        return "Specified pool type only takes one device path";
+                }
+        }
 
         return NULL;
 }
@@ -261,12 +269,15 @@
 
         init_disk_pool(pool);
 
+        pool->pool_info.disk.pool_type = type;
+
         switch (type) {
         case DISK_POOL_DIR:
                 break;
         case DISK_POOL_FS:
         case DISK_POOL_DISK:
-                msg = disk_fs_or_disk_pool(inst, pool);
+        case DISK_POOL_LOGICAL:
+                msg = disk_fs_or_disk_or_logical_pool(inst, pool);
                 break;
         case DISK_POOL_NETFS:
                 msg = disk_netfs_pool(inst, pool);
@@ -281,8 +292,6 @@
         if (msg != NULL)
                 goto out;
 
-        pool->pool_info.disk.pool_type = type;
-
         if (cu_get_str_prop(inst, "Path", &val) != CMPI_RC_OK)
                 return "Missing `Path' property";
 




More information about the Libvirt-cim mailing list