
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_Device.c | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/src/Virt_Device.c b/src/Virt_Device.c index 12ae6bd..f100f6b 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -366,6 +366,33 @@ static CMPIInstance *input_instance(const CMPIBroker *broker, return inst; } +static CMPIInstance *controller_instance(const CMPIBroker *broker, + struct controller_device *dev, + const virDomainPtr dom, + const char *ns) +{ + CMPIInstance *inst; + virConnectPtr conn; + + conn = virDomainGetConnect(dom); + inst = get_typed_instance(broker, + pfx_from_conn(conn), + "Controller", + ns, + true); + if (inst == NULL) { + CU_DEBUG("Failed to get instance of ControllerDevice"); + return NULL; + } + + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->type, CMPI_chars); + CMSetProperty(inst, "Controller", + (CMPIValue *)dev->model, CMPI_chars); + + return inst; +} + static int device_set_devid(CMPIInstance *instance, struct virt_device *dev, const virDomainPtr dom) @@ -516,11 +543,16 @@ static bool device_instances(const CMPIBroker *broker, &dev->dev.console, dom, ns); - else if (dev->type == CIM_RES_TYPE_INPUT) + else if (dev->type == CIM_RES_TYPE_INPUT) instance = input_instance(broker, &dev->dev.input, dom, ns); + else if (dev->type == CIM_RES_TYPE_CONTROLLER) + instance = controller_instance(broker, + &dev->dev.controller, + dom, + ns); else return false; -- 1.7.1