
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- src/Virt_VirtualSystemManagementService.c | 44 +++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index e146470..1a34ff8 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1848,6 +1848,28 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst, return NULL; }
+static const char *controller_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) +{ + const char *val; + + if (cu_get_str_prop(inst, "Type", &val) != CMPI_RC_OK) { + CU_DEBUG("ControllerRASD Type field not valid"); + goto out; + } + dev->dev.controller.type = strdup(val); + + if (cu_get_str_prop(inst, "Model", &val) != CMPI_RC_OK) { + CU_DEBUG("Invalid value for Model in ControllerRASD"); + goto out; + } + dev->dev.controller.model = strdup(val); I have already written before that the CIM instance uniqueness is with
On 03/03/2014 08:38 AM, Xu Wang wrote: the current code not guaranteed. I suggest the following schema for the instanceID: <domain name>/controller:<ResourceSubType>:<Index> To accomplish this you need to set dev->id here to (abbreviated) "controller:"+dev->dev.controller.type+":"dev->dev.controller.index btw. this is also needed to be set in method parse_controller_device in libxkutil/device_parsing.c I might have missed that before.
+ + out: + + return NULL; +} + static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, uint16_t type, @@ -1868,6 +1890,8 @@ static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst, return console_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); }
return "Resource type not supported on this platform"; @@ -1888,6 +1912,8 @@ static const char *_container_rasd_to_vdev(CMPIInstance *inst, return lxc_proc_rasd_to_vdev(inst, dev); } else if (type == CIM_RES_TYPE_INPUT) { return input_rasd_to_vdev(inst, dev); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + return controller_rasd_to_vdev(inst, dev); }
return "Resource type not supported on this platform"; @@ -1997,6 +2023,9 @@ static const char *classify_resources(CMPIArray *resources, if (!make_space(&domain->dev_input, domain->dev_input_ct, count)) return "Failed to alloc input list";
+ if (!make_space(&domain->dev_controller, domain->dev_controller_ct, count)) + return "Failed to alloc controller list"; + for (i = 0; i < count; i++) { CMPIObjectPath *op; CMPIData item; @@ -2111,7 +2140,16 @@ static const char *classify_resources(CMPIArray *resources, &domain->dev_input[0], ns, p_error); + } else if (type == CIM_RES_TYPE_CONTROLLER) { + msg = rasd_to_vdev(inst, + domain, + &domain->dev_controller[domain->dev_controller_ct], + ns, + p_error); + if (msg == NULL) + domain->dev_controller_ct += 1; } + if (msg != NULL) return msg;
@@ -2918,6 +2956,9 @@ static struct virt_device **find_list(struct domain *dominfo, } else if (type == CIM_RES_TYPE_INPUT) { list = &dominfo->dev_input; *count = &dominfo->dev_input_ct; + } else if (type == CIM_RES_TYPE_CONTROLLER) { + list = &dominfo->dev_controller; + *count = &dominfo->dev_controller_ct; }
return list; @@ -3039,6 +3080,7 @@ static CMPIStatus resource_del(struct domain *dominfo, if (STREQ(dev->id, devid)) { if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_CONSOLE) || + (type == CIM_RES_TYPE_CONTROLLER) || In libvirt controller can be dynamically added and deleted (hotplug and hotunplug). If I am not mistaken you prevent this here and also below (resource_add & resource_mod). (type == CIM_RES_TYPE_INPUT)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else { @@ -3121,6 +3163,7 @@ static CMPIStatus resource_add(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) { (*count)++; cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); @@ -3198,6 +3241,7 @@ static CMPIStatus resource_mod(struct domain *dominfo,
if ((type == CIM_RES_TYPE_GRAPHICS) || (type == CIM_RES_TYPE_INPUT) || + (type == CIM_RES_TYPE_CONTROLLER) || (type == CIM_RES_TYPE_CONSOLE)) cu_statusf(_BROKER, &s, CMPI_RC_OK, ""); else {
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294