# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1196156053 -3600
# Node ID ce846c470102c9c126b027c68d58f5205cadfb10
# Parent a73fce7861b2fef889762fc2c4d8f70e7ea499a1
Enumeration on VirtualSystemManagementService class is returning dups
On systems where only one hypervisor is existing, the provider
returned instance for all known subclasses (Xen, KVM).
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r a73fce7861b2 -r ce846c470102 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Nov 27 10:32:04 2007 +0100
+++ b/src/Virt_VirtualSystemManagementService.c Tue Nov 27 10:34:13 2007 +0100
@@ -1048,20 +1048,27 @@ CMPIStatus get_vsms(const CMPIObjectPath
CMPIStatus get_vsms(const CMPIObjectPath *reference,
CMPIInstance **_inst,
const CMPIBroker *broker)
-{
- CMPIStatus s;
- CMPIInstance *inst;
- CMPIInstance *host;
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ CMPIInstance *host = NULL;
char *val = NULL;
+ virConnectPtr conn = NULL;
+
+ *_inst = NULL;
+ conn = connect_by_classname(broker, CLASSNAME(reference), &s);
+ if (conn == NULL)
+ return s;
s = get_host_cs(broker, reference, &host);
if (s.rc != CMPI_RC_OK)
goto out;
inst = get_typed_instance(broker,
- CLASSNAME(reference),
+ pfx_from_conn(conn),
"VirtualSystemManagementService",
NAMESPACE(reference));
+
if (inst == NULL) {
CU_DEBUG("Failed to get typed instance");
cu_statusf(broker, &s,
@@ -1076,7 +1083,7 @@ CMPIStatus get_vsms(const CMPIObjectPath
if (cu_get_str_prop(host, "Name", &val) != CMPI_RC_OK) {
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
- "Unable to get name of System");
+ "Unable to get name of HostSystem");
goto out;
}
@@ -1087,7 +1094,7 @@ CMPIStatus get_vsms(const CMPIObjectPath
if (cu_get_str_prop(host, "CreationClassName", &val) != CMPI_RC_OK)
{
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
- "Unable to get creation class of system");
+ "Unable to get creation class of HostSystem");
goto out;
}
@@ -1097,8 +1104,10 @@ CMPIStatus get_vsms(const CMPIObjectPath
CMSetStatus(&s, CMPI_RC_OK);
+ out:
+ virConnectClose(conn);
*_inst = inst;
- out:
+
return s;
}
@@ -1106,19 +1115,17 @@ static CMPIStatus return_vsms(const CMPI
const CMPIResult *results,
int name_only)
{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *inst;
- CMPIStatus s;
s = get_vsms(reference, &inst, _BROKER);
- if (s.rc != CMPI_RC_OK)
+ if (s.rc != CMPI_RC_OK || inst == NULL)
goto out;
if (name_only)
cu_return_instance_name(results, inst);
else
CMReturnInstance(results, inst);
-
- CMSetStatus(&s, CMPI_RC_OK);
out:
return s;
}
Show replies by date
HE> # HG changeset patch
HE> # User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
HE> # Date 1196156053 -3600
HE> # Node ID ce846c470102c9c126b027c68d58f5205cadfb10
HE> # Parent a73fce7861b2fef889762fc2c4d8f70e7ea499a1
HE> Enumeration on VirtualSystemManagementService class is returning dups
Applied, thanks!
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com