[PATCH 0 of 2] Added match_hypervisor_prefix() to association's handler functions to avoid wrong results

A request wbemain -ac Xen_<classname> http://localhost/root/virt:KVM_<classname> should not return any results, but did so for HD and HRP.

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196845867 -3600 # Node ID ce0b042ac7dea58ab7767e5bc74db81c37f99352 # Parent b21fd24be46e086824d309f652b68ebe17eea34b HD: Added match_hypervisor_prefix to avoid wrong results The request wbemain -ac Xen_HostedDependency 'http://localhost/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="qemu1"' returned localhost:5988/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="localhost.localdomain" which is wrong, as KVM_ComputerSystem is referenced to KVM_HostSystem via KVM_HostedDependency instead of Xen_HostedDependency. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r b21fd24be46e -r ce0b042ac7de src/Virt_HostedDependency.c --- a/src/Virt_HostedDependency.c Wed Dec 05 09:42:26 2007 +0100 +++ b/src/Virt_HostedDependency.c Wed Dec 05 10:11:07 2007 +0100 @@ -40,8 +40,11 @@ static CMPIStatus vs_to_host(const CMPIO struct std_assoc_info *info, struct inst_list *list) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *instance; + + if (!match_hypervisor_prefix(ref, info)) + return s; s = get_host_cs(_BROKER, ref, &instance); if (s.rc == CMPI_RC_OK) @@ -56,7 +59,10 @@ static CMPIStatus host_to_vs(const CMPIO { int ret; virConnectPtr conn; - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK, NULL}; + + if (!match_hypervisor_prefix(ref, info)) + return s; conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL)

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196846065 -3600 # Node ID c3e4344951cef32a2c89e90f5345b20171c5e58d # Parent ce0b042ac7dea58ab7767e5bc74db81c37f99352 HRP: Added match_hypervisor_prefix to avoid wrong results The request wbemain -ac Xen_HostedResourcePool 'http://localhost/root/virt:KVM_HostSystem.CreationClassName="KVM_HostSystem",Name="localhost.localdomain"' returned localhost:5988/root/virt:KVM_ProcessorPool.InstanceID="ProcessorPool/0" localhost:5988/root/virt:KVM_MemoryPool.InstanceID="MemoryPool/0" localhost:5988/root/virt:KVM_DiskPool.InstanceID="DiskPool/foo" which is wrong, as KVM_HostSystem is referenced to KVM_MemoryPool (...) via KVM_HostedResourcePool instead of Xen_HostedResourcePool. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r ce0b042ac7de -r c3e4344951ce src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Wed Dec 05 10:11:07 2007 +0100 +++ b/src/Virt_HostedResourcePool.c Wed Dec 05 10:14:25 2007 +0100 @@ -42,7 +42,10 @@ static CMPIStatus pool_to_sys(const CMPI struct inst_list *list) { CMPIInstance *host; - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK, NULL}; + + if (!match_hypervisor_prefix(ref, info)) + return s; s = get_host_cs(_BROKER, ref, &host); if (s.rc != CMPI_RC_OK) @@ -57,11 +60,14 @@ static CMPIStatus sys_to_pool(const CMPI struct std_assoc_info *info, struct inst_list *list) { - CMPIStatus s; + CMPIStatus s = {CMPI_RC_OK, NULL}; int i; virConnectPtr conn; CMPIInstance *host; const char *prop; + + if (!match_hypervisor_prefix(ref, info)) + return s; s = get_host_cs(_BROKER, ref, &host); if (s.rc != CMPI_RC_OK)

Heidi Eckhart wrote:
A request wbemain -ac Xen_<classname> http://localhost/root/virt:KVM_<classname> should not return any results, but did so for HD and HRP.
Nice job finding this. Looks like match_hypervisor_prefix is working out nicely. +1 P.S. We've tested match_hypervisor_prefix with both sfcb and pegasus, right? I'd love to know we finally have this duplicates issue resolved for both CIMOMs. -- -Jay

Jay Gagnon wrote:
P.S. We've tested match_hypervisor_prefix with both sfcb and pegasus, right? I'd love to know we finally have this duplicates issue resolved for both CIMOMs.
Yes, tested and works with both - Pegasus and sfcb. Next CIMOM to test is openWbem. -- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (2)
-
Heidi Eckhart
-
Jay Gagnon