# HG changeset patch
# User Sharad Mishra<snmishra(a)us.ibm.com>
# Date 1253292817 25200
# Node ID f916b221ea7e21b091d36ef841eb3bde1813798d
# Parent fc50acd35fe7f344e296441a88a00f42a7636ad6
This patch replaces get_previous_instance function with get_rasd_by_name().
Signed-off-by: Sharad Mishra<snmishra(a)us.ibm.com>
diff -r fc50acd35fe7 -r f916b221ea7e src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Sep 16 11:49:21 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Fri Sep 18 09:53:37 2009 -0700
@@ -2185,49 +2185,6 @@
return s;
}
-static CMPIInstance *get_previous_instance(struct domain *dominfo,
- const CMPIObjectPath *ref,
- uint16_t type,
- const char *devid)
-{
- CMPIStatus s;
- const char *props[] = {NULL};
- const char *inst_id;
- struct inst_list list;
- CMPIInstance *prev_inst = NULL;
- int i, ret;
-
- inst_list_init(&list);
- s = enum_rasds(_BROKER, ref, dominfo->name, type, props,&list);
- if (s.rc != CMPI_RC_OK) {
- CU_DEBUG("Failed to enumerate rasd");
- goto out;
- }
-
- for(i = 0; i< list.cur; i++) {
- prev_inst = list.list[i];
- ret = cu_get_str_prop(prev_inst,
- "InstanceID",
-&inst_id);
-
- if (ret != CMPI_RC_OK) {
- CU_DEBUG("Cannot get InstanceID ... ignoring");
- continue;
- }
-
- if (STREQ(inst_id, get_fq_devid(dominfo->name, (char *)devid)))
- break;
- }
-
- if (prev_inst == NULL)
- CU_DEBUG("PreviousInstance is NULL");
-
- out:
- inst_list_free(&list);
-
- return prev_inst;
-}
-
static CMPIStatus _update_resources_for(const CMPIContext *context,
const CMPIObjectPath *ref,
virDomainPtr dom,
@@ -2276,7 +2233,24 @@
}
else {
indication = strdup(RASD_IND_MODIFIED);
- prev_inst = get_previous_instance(dominfo, ref, type, devid);
+ char *dummy_name = NULL;
+
+ if (asprintf(&dummy_name, "%s/%s",dominfo->name, devid)
== -1) {
+ CU_DEBUG("Unable to set name");
+ goto out;
+ }
+ s = get_rasd_by_name(_BROKER,
+ ref,
+ dummy_name,
+ type,
+ NULL,
+&prev_inst);
+ free(dummy_name);
+
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Failed to get Previous Instance");
+ goto out;
+ }
}
s = func(dominfo, rasd, type, devid, NAMESPACE(ref));
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel(a)linux.vnet.ibm.com