[Libvirt-cim] [PATCH 2 of 2] Add netfs disk pool attributes to schema, RPCS support, and template RASDs

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed May 6 01:24:38 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1241572138 25200
# Node ID 570c3507c7b2c3e55680e9a70f4889accb9a1cf7
# Parent  0bbc6afa622ccea1b57b5a92dbf228a61b6aee6b
Add netfs disk pool attributes to schema, RPCS support, and template RASDs

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

diff -r 0bbc6afa622c -r 570c3507c7b2 schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof	Tue May 05 18:08:58 2009 -0700
+++ b/schema/ResourceAllocationSettingData.mof	Tue May 05 18:08:58 2009 -0700
@@ -223,6 +223,8 @@
       uint16 Type;
       string Path;
       string DevicePath;
+      string Host;
+      string SourceDirectory;
 };
 
 [Description ("KVM virtual disk pool settings"),
@@ -237,6 +239,8 @@
       uint16 Type;
       string Path;
       string DevicePath;
+      string Host;
+      string SourceDirectory;
 };
 
 [Description ("LXC virtual disk pool settings"),
@@ -251,5 +255,7 @@
       uint16 Type;
       string Path;
       string DevicePath;
+      string Host;
+      string SourceDirectory;
 };
 
diff -r 0bbc6afa622c -r 570c3507c7b2 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c	Tue May 05 18:08:58 2009 -0700
+++ b/src/Virt_ResourcePoolConfigurationService.c	Tue May 05 18:08:58 2009 -0700
@@ -144,6 +144,8 @@
 {
         pool->pool_info.disk.device_path = NULL;
         pool->pool_info.disk.path = NULL;
+        pool->pool_info.disk.host = NULL;
+        pool->pool_info.disk.src_dir = NULL;
 }
 
 static const char *disk_fs_pool(CMPIInstance *inst,
@@ -159,6 +161,24 @@
         return NULL;
 }
 
+static const char *disk_netfs_pool(CMPIInstance *inst,
+                                   struct virt_pool *pool)
+{
+        const char *val = NULL;
+
+        if (cu_get_str_prop(inst, "Host", &val) != CMPI_RC_OK)
+                return "Missing `Host' property";
+
+        pool->pool_info.disk.host = strdup(val);
+
+        if (cu_get_str_prop(inst, "SourceDirectory", &val) != CMPI_RC_OK)
+                return "Missing `SourceDirectory' property";
+
+        pool->pool_info.disk.src_dir = strdup(val);
+
+        return NULL;
+}
+
 static const char *disk_rasd_to_pool(CMPIInstance *inst,
                                     struct virt_pool *pool)
 {
@@ -179,6 +199,11 @@
                 if (msg != NULL)
                         goto out;
                 break;
+        case DISK_POOL_NETFS:
+                msg = disk_netfs_pool(inst, pool);
+                if (msg != NULL)
+                        goto out;
+                break;
         default:
                 return "Storage pool type not supported";
         }
diff -r 0bbc6afa622c -r 570c3507c7b2 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Tue May 05 18:08:58 2009 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Tue May 05 18:08:58 2009 -0700
@@ -1240,8 +1240,10 @@
         CMPIStatus s = {CMPI_RC_OK, NULL};
         const char *path = "/dev/null";
         const char *dev_path;
-        int type[2] = {DISK_POOL_DIR, DISK_POOL_FS};
-        int pool_types = 2;
+        const char *host;
+        const char *src_dir;
+        int type[3] = {DISK_POOL_DIR, DISK_POOL_FS, DISK_POOL_NETFS};
+        int pool_types = 3;
         int i;
 
         switch (template_type) {
@@ -1277,6 +1279,15 @@
                         CMSetProperty(inst, "DevicePath", 
                                       (CMPIValue *)dev_path, CMPI_chars);
                         break;
+                case DISK_POOL_NETFS:
+                        host = "host_sys.domain.com";
+                        CMSetProperty(inst, "Host", 
+                                      (CMPIValue *)host, CMPI_chars);
+
+                        src_dir = "/var/lib/images";
+                        CMSetProperty(inst, "SourceDirectory", 
+                                      (CMPIValue *)src_dir, CMPI_chars);
+                        break;
                 default:
                         break;
                 }




More information about the Libvirt-cim mailing list