
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1226939110 28800 # Node ID e43c88db84c7bdf89dbe2d2fd28e990f081e5c37 # Parent 7d43dee14fefe065b3258116bc5f09d3daa3576b Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 7d43dee14fef -r e43c88db84c7 Makefile.am --- a/Makefile.am Fri Nov 14 15:05:47 2008 -0700 +++ b/Makefile.am Mon Nov 17 08:25:10 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 7d43dee14fef -r e43c88db84c7 schema/GraphicsPool.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/GraphicsPool.mof Mon Nov 17 08:25:10 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 7d43dee14fef -r e43c88db84c7 schema/GraphicsPool.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/GraphicsPool.registration Mon Nov 17 08:25:10 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 7d43dee14fef -r e43c88db84c7 schema/InputPool.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/InputPool.mof Mon Nov 17 08:25:10 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 7d43dee14fef -r e43c88db84c7 schema/InputPool.registration --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/InputPool.registration Mon Nov 17 08:25:10 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 7d43dee14fef -r e43c88db84c7 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Nov 14 15:05:47 2008 -0700 +++ b/src/Virt_DevicePool.c Mon Nov 17 08:25:10 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,