On 03/25/2014 03:20 AM, Xu Wang wrote:
Signed-off-by: Xu Wang <gesaint(a)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");
CU_DEBUG("Failed to get instance of %s_Controller",
pfx_from_conn(conn));
+ return NULL;
+ }
+
+ CMSetProperty(inst, "Controller",
+ (CMPIValue *)dev->type, CMPI_chars);
+ CMSetProperty(inst, "Controller",
+ (CMPIValue *)dev->model, CMPI_chars);
Not sure what you were setting here as there's not a "Controller"
property from what I read... In any case, these will become:
const char *type_str;
type_str = controller_protocol_type_IDToStr(dev->type);
if (type_str == NULL) {
CU_DEBUG("controller type=%d fails to return string",
dev->type);
return 0;
}
CMSetProperty(inst, "ProtocolSupported",
(CMPIValue *)dev->type,
CMPI_uint16);
if (dev->model)
CMSetProperty(inst, "ProtocolDescription",
(CMPIValue *)dev->model,
CMPI_chars);
Where the ProtocolSupported type will come from a new enum list in
svpc_types.h as taken from the docs. The ProtocolDescription is the
free form description with more detail
+
+ 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;