[Libvirt-cim] [PATCH 2 of 3] Add support for defining an LXC guest with a DiskRASD

Dan Smith danms at us.ibm.com
Mon May 5 16:45:24 UTC 2008


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1210005853 25200
# Node ID 51420bb16e9a4e1ff1a125aa4333a6d29e6f8234
# Parent  577e78027b67fa2437418ae540bac190d4cdf50b
Add support for defining an LXC guest with a DiskRASD

Also, process the system information first, so that the device processing
code can know what type of domain is being created.

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 577e78027b67 -r 51420bb16e9a src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Mon May 05 09:44:13 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Mon May 05 09:44:13 2008 -0700
@@ -413,6 +413,27 @@ static const char *disk_rasd_to_vdev(CMP
         return NULL;
 }
 
+static const char *lxc_disk_rasd_to_vdev(CMPIInstance *inst,
+                                         struct virt_device *dev)
+{
+        const char *val = NULL;
+
+        if (cu_get_str_prop(inst, "MountPoint", &val) != CMPI_RC_OK)
+                return "Missing `MountPoint' field";
+
+        free(dev->dev.disk.virtual_dev);
+        dev->dev.disk.virtual_dev = strdup(val);
+
+        if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK)
+                return "Missing `Address' field";
+
+        free(dev->dev.disk.source);
+        dev->dev.disk.source = strdup(val);
+        dev->dev.disk.disk_type = DISK_FS;
+
+        return NULL;
+}
+
 static const char *mem_rasd_to_vdev(CMPIInstance *inst,
                                     struct virt_device *dev)
 {
@@ -447,6 +468,8 @@ static const char *_container_rasd_to_vd
 {
         if (type == CIM_RES_TYPE_MEM) {
                 return mem_rasd_to_vdev(inst, dev);
+        } else if (type == CIM_RES_TYPE_DISK) {
+                return lxc_disk_rasd_to_vdev(inst, dev);
         }
 
         return "Resource type not supported on this platform";
@@ -611,20 +634,20 @@ static CMPIInstance *create_system(CMPII
                 goto out;
         }
 
+        if (!vssd_to_domain(vssd, domain)) {
+                CU_DEBUG("Failed to create domain from VSSD");
+                cu_statusf(_BROKER, s,
+                           CMPI_RC_ERR_FAILED,
+                           "SystemSettings Error");
+                goto out;
+        }
+
         msg = classify_resources(resources, NAMESPACE(ref), domain);
         if (msg != NULL) {
                 CU_DEBUG("Failed to classify resources: %s", msg);
                 cu_statusf(_BROKER, s,
                            CMPI_RC_ERR_FAILED,
                            "ResourceSettings Error: %s", msg);
-                goto out;
-        }
-
-        if (!vssd_to_domain(vssd, domain)) {
-                CU_DEBUG("Failed to create domain from VSSD");
-                cu_statusf(_BROKER, s,
-                           CMPI_RC_ERR_FAILED,
-                           "SystemSettings Error");
                 goto out;
         }
 




More information about the Libvirt-cim mailing list