On 03/13/2014 11:27 PM, John Ferlan wrote:
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/Virt_VirtualSystemManagementService.c | 38 ++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
index 9634481..b478d41 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1841,23 +1841,42 @@ static const char *input_rasd_to_vdev(CMPIInstance *inst,
static const char *controller_rasd_to_vdev(CMPIInstance *inst,
struct virt_device *dev)
{
- const char *val;
+ const char *val = NULL;
+ const char *msg = NULL;
+ int ret;
- if (cu_get_str_prop(inst, "Type", &val) != CMPI_RC_OK) {
- CU_DEBUG("ControllerRASD Type field not valid");
+ if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK)
{
+ CU_DEBUG("ControllerRASD ResourceSubType field not valid");
goto out;
}
dev->dev.controller.type = strdup(val);
cu_get_u64_prop if Index is of type uint64
+ if (cu_get_u32_prop(inst, "Index",
+ &dev->dev.controller.index) != CMPI_RC_OK) {
CU_DEBUG("ControllerRASD Index not set - DEFAULT");
dev->dev.controller.index =
CONTROLLER_INDEX_NOT_SET;
} else {
if (asprintf(&dev->id,
"controller:%s:%" PRIu64,
dev->dev.controller.type,
dev->dev.controller.index) == -1) {
CU_DEBUG("Failed to create controller
id string");
msg = "Failed to create controller id
string";
goto out;
}
}
It is possible that index during the creation of domain is not specified
and than libvirt will define the index itself.
+ CU_DEBUG("ControllerRASD Index field not
valid");
+ goto out;
+ }
+
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);
---- snip ----
+ ret = asprintf(&dev->id,
"controller:%s:%s",
+ dev->dev.controller.type,
+ dev->dev.controller.index);
+ if (ret == -1) {
+ msg = "Failed to create controller string";
+ goto out;
+ }
---- snap ----
the above block could be deleted
+
+ msg = rasd_to_device_address(inst, &dev->dev.controller.address);
+
+
out:
- return NULL;
+ return ;
This should probably be
return msg;
}
static const char *_sysvirt_rasd_to_vdev(CMPIInstance *inst,
@@ -2131,13 +2150,20 @@ static const char *classify_resources(CMPIArray *resources,
ns,
p_error);
} else if (type == CIM_RES_TYPE_CONTROLLER) {
+ struct virt_device dev;
+ int dcount = count + domain->dev_controller_ct;
+
+ memset(&dev, 0, sizeof(dev));
msg = rasd_to_vdev(inst,
domain,
-
&domain->dev_controller[domain->dev_controller_ct],
+ &dev,
ns,
p_error);
if (msg == NULL)
- domain->dev_controller_ct += 1;
+ msg = add_device_nodup(&dev,
+ domain->dev_controller,
+ dcount,
+ &domain->dev_controller_ct);
}
if (msg != NULL)
--
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