[Libvirt-cim] [PATCH 1 of 4] Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Nov 14 20:42:33 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1226694598 28800
# Node ID d80817bf94080daa8acc341794565868f4c58ac5
# Parent  5680eb18d7ea2971acf4fbdb50e3e69f5c014ef0
Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 5680eb18d7ea -r d80817bf9408 Makefile.am
--- a/Makefile.am	Wed Nov 05 15:13:38 2008 -0800
+++ b/Makefile.am	Fri Nov 14 12:29:58 2008 -0800
@@ -49,7 +49,9 @@
         schema/ServiceAffectsElement.mof \
         schema/KVMRedirectionSAP.mof \
         schema/DisplayController.mof \
-        schema/PointingDevice.mof
+        schema/PointingDevice.mof \
+        schema/GraphicsPool.mof \
+        schema/InputPool.mof
 
 INTEROP_MOFS = \
 	schema/ComputerSystem.mof \
@@ -113,7 +115,9 @@
         schema/ServiceAffectsElement.registration \
         schema/KVMRedirectionSAP.registration \
         schema/DisplayController.registration \
-        schema/PointingDevice.registration
+        schema/PointingDevice.registration \
+        schema/GraphicsPool.registration \
+        schema/InputPool.registration
 
 INTEROP_REGS = \
 	schema/RegisteredProfile.registration \
diff -r 5680eb18d7ea -r d80817bf9408 schema/GraphicsPool.mof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/GraphicsPool.mof	Fri Nov 14 12:29:58 2008 -0800
@@ -0,0 +1,16 @@
+// Copyright IBM Corp. 2007
+
+[Provider("cmpi::Virt_DevicePool")]
+class Xen_GraphicsPool : CIM_ResourcePool
+{
+};
+
+[Provider("cmpi::Virt_DevicePool")]
+class KVM_GraphicsPool : CIM_ResourcePool
+{
+};
+
+[Provider("cmpi::Virt_DevicePool")]
+class LXC_GraphicsPool : CIM_ResourcePool
+{
+};
diff -r 5680eb18d7ea -r d80817bf9408 schema/GraphicsPool.registration
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/GraphicsPool.registration	Fri Nov 14 12:29:58 2008 -0800
@@ -0,0 +1,5 @@
+# Copyright IBM Corp. 2007
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Xen_GraphicsPool root/virt Virt_DevicePool Virt_DevicePool instance
+KVM_GraphicsPool root/virt Virt_DevicePool Virt_DevicePool instance
+LXC_GraphicsPool root/virt Virt_DevicePool Virt_DevicePool instance
diff -r 5680eb18d7ea -r d80817bf9408 schema/InputPool.mof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/InputPool.mof	Fri Nov 14 12:29:58 2008 -0800
@@ -0,0 +1,16 @@
+// Copyright IBM Corp. 2007
+
+[Provider("cmpi::Virt_DevicePool")]
+class Xen_InputPool : CIM_ResourcePool
+{
+};
+
+[Provider("cmpi::Virt_DevicePool")]
+class KVM_InputPool : CIM_ResourcePool
+{
+};
+
+[Provider("cmpi::Virt_DevicePool")]
+class LXC_InputPool : CIM_ResourcePool
+{
+};
diff -r 5680eb18d7ea -r d80817bf9408 schema/InputPool.registration
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/InputPool.registration	Fri Nov 14 12:29:58 2008 -0800
@@ -0,0 +1,5 @@
+# Copyright IBM Corp. 2007
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Xen_InputPool root/virt Virt_DevicePool Virt_DevicePool instance
+KVM_InputPool root/virt Virt_DevicePool Virt_DevicePool instance
+LXC_InputPool root/virt Virt_DevicePool Virt_DevicePool instance
diff -r 5680eb18d7ea -r d80817bf9408 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Wed Nov 05 15:13:38 2008 -0800
+++ b/src/Virt_DevicePool.c	Fri Nov 14 12:29:58 2008 -0800
@@ -478,6 +478,10 @@
                 poolid = netpool_member_of(broker, id, refcn);
         else if (type == CIM_RES_TYPE_DISK)
                 poolid = diskpool_member_of(broker, id, refcn);
+        else if (type == CIM_RES_TYPE_GRAPHICS)
+                poolid = strdup("GraphicsPool/0");
+        else if (type == CIM_RES_TYPE_INPUT)
+                poolid = strdup("InputPool/0");
         else
                 return NULL;
 
@@ -494,6 +498,10 @@
                 return CIM_RES_TYPE_MEM;
         else if (strstr(classname, "ProcessorPool"))
                 return CIM_RES_TYPE_PROC;
+        else if (strstr(classname, "GraphicsPool"))
+                return CIM_RES_TYPE_GRAPHICS;
+        else if (strstr(classname, "InputPool"))
+                return CIM_RES_TYPE_INPUT;
         else
                 return CIM_RES_TYPE_UNKNOWN;
 }
@@ -508,6 +516,10 @@
                 return CIM_RES_TYPE_MEM;
         else if (STARTS_WITH(id, "ProcessorPool"))
                 return CIM_RES_TYPE_PROC;
+        else if (strstr(id, "GraphicsPool"))
+                return CIM_RES_TYPE_GRAPHICS;
+        else if (strstr(id, "InputPool"))
+                return CIM_RES_TYPE_INPUT;
         else
                 return CIM_RES_TYPE_UNKNOWN;
 }
@@ -841,6 +853,78 @@
         return s;
 }
 
+static CMPIStatus graphicspool_instance(virConnectPtr conn,
+                                        struct inst_list *list,
+                                        const char *ns,
+                                        const char *_id,
+                                        const CMPIBroker *broker)
+{
+        const char *id = "GraphicsPool/0";
+        CMPIInstance *inst;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+
+        if ((_id != NULL) && (!STREQC(_id, "0"))) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "No such graphics pool `%s'", id);
+                return s;
+        }
+
+        inst = get_typed_instance(broker,
+                                  pfx_from_conn(conn),
+                                  "GraphicsPool",
+                                  ns);
+        if (inst == NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Failed to get instance of %s_GraphicsPool", 
+                           pfx_from_conn(conn));
+                return s;
+        }
+
+        set_params(inst, CIM_RES_TYPE_GRAPHICS, id, NULL, NULL);
+
+        inst_list_add(list, inst);
+
+        return s;
+}
+
+static CMPIStatus inputpool_instance(virConnectPtr conn,
+                                     struct inst_list *list,
+                                     const char *ns,
+                                     const char *_id,
+                                     const CMPIBroker *broker)
+{
+        const char *id = "InputPool/0";
+        CMPIInstance *inst;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+
+        if ((_id != NULL) && (!STREQC(_id, "0"))) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "No such input pool `%s'", id);
+                return s;
+        }
+
+        inst = get_typed_instance(broker,
+                                  pfx_from_conn(conn),
+                                  "InputPool",
+                                  ns);
+        if (inst == NULL) {
+                cu_statusf(broker, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Failed to get instance of %s_InputPool", 
+                           pfx_from_conn(conn));
+                return s;
+        }
+
+        set_params(inst, CIM_RES_TYPE_INPUT, id, NULL, NULL);
+
+        inst_list_add(list, inst);
+
+        return s;
+}
+
 static CMPIStatus _get_pools(const CMPIBroker *broker,
                              const CMPIObjectPath *reference,
                              const uint16_t type,
@@ -885,6 +969,22 @@
                                       NAMESPACE(reference),
                                       id,
                                       broker);
+
+        if ((type == CIM_RES_TYPE_GRAPHICS) || 
+            (type == CIM_RES_TYPE_ALL))
+                s = graphicspool_instance(conn,
+                                          list,
+                                          NAMESPACE(reference),
+                                          id,
+                                          broker);
+
+        if ((type == CIM_RES_TYPE_INPUT) || 
+            (type == CIM_RES_TYPE_ALL))
+                s = inputpool_instance(conn,
+                                       list,
+                                       NAMESPACE(reference),
+                                       id,
+                                       broker);
 
         if (type == CIM_RES_TYPE_UNKNOWN)
                 cu_statusf(broker, &s,
@@ -1029,6 +1129,16 @@
                 *s = enum_pools(broker, reference, type, &list);
                 if ((s->rc == CMPI_RC_OK) && (list.cur > 0))
                         inst = list.list[0];
+        } else if (type == CIM_RES_TYPE_GRAPHICS) {
+                *s = get_pool_by_name(broker, 
+                                      reference, 
+                                      "GraphicsPool/0", 
+                                      &inst);
+        } else if (type == CIM_RES_TYPE_INPUT) {
+                *s = get_pool_by_name(broker, 
+                                      reference, 
+                                      "InputPool/0", 
+                                      &inst);
         } else {
                 cu_statusf(broker, s,
                            CMPI_RC_ERR_INVALID_PARAMETER,




More information about the Libvirt-cim mailing list