[PATCH 0 of 2] Fix AllocationCapabilities enum and get malfunction

- enumeration broke CIM model by reporting an error in case of non-existing hypervisor - getInstance seg faulted by missing ERR_NOT_FOUND in case of non-existing hypervisor

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201175803 -3600 # Node ID 65e42d8fd81f65e561b32c99189e9940e0556d00 # Parent 43e7713d011fa74f96da379896ca9d1f2cb16205 AllocationCapabilities provider returns error code in case of non-error wbemein http://localhost/root/virt:CIM_AllocationCapabilities returns CIM_ERR_FAILED: Could not connect to hypervisor in case of a KVM system with no Xen. The error message results from the call to the Xen_AllocationCapabilties part, which should only be tested but returning OK. Otherwise the provider breaks the CIM model. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 43e7713d011f -r 65e42d8fd81f src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Thu Jan 24 10:35:05 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:43 2008 +0100 @@ -91,12 +91,8 @@ CMPIStatus enum_alloc_cap_instances(cons goto out; conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "Could not connect to hypervisor"); - goto out; - } + if (conn == NULL) + goto out; s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); if (s.rc != CMPI_RC_OK) {

Heidi Eckhart wrote:
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201175803 -3600 # Node ID 65e42d8fd81f65e561b32c99189e9940e0556d00 # Parent 43e7713d011fa74f96da379896ca9d1f2cb16205 AllocationCapabilities provider returns error code in case of non-error
wbemein http://localhost/root/virt:CIM_AllocationCapabilities returns CIM_ERR_FAILED: Could not connect to hypervisor in case of a KVM system with no Xen. The error message results from the call to the Xen_AllocationCapabilties part, which should only be tested but returning OK. Otherwise the provider breaks the CIM model.
Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com>
diff -r 43e7713d011f -r 65e42d8fd81f src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Thu Jan 24 10:35:05 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:43 2008 +0100 @@ -91,12 +91,8 @@ CMPIStatus enum_alloc_cap_instances(cons goto out;
conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) { - cu_statusf(broker, &s, - CMPI_RC_ERR_FAILED, - "Could not connect to hypervisor"); - goto out; - } + if (conn == NULL) + goto out;
s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); if (s.rc != CMPI_RC_OK) {
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
It's a good thing we don't have a place to record "number of times Jay has broken the CIM model." As usual, thanks for catching my mistake here. :) +1 -- -Jay

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201175805 -3600 # Node ID 70dedb925282ed3ceccf95872537204a1531c777 # Parent 65e42d8fd81f65e561b32c99189e9940e0556d00 AllocationCapabilities getInstance seg faults on KVM system with Xen request wbemgi 'http://localhost:5988/root/virt:Xen_AllocationCapabilities.InstanceID="ProcessorPool/0"' on a KVM system seg faults, as not the appropriate error code is set. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 65e42d8fd81f -r 70dedb925282 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:43 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:45 2008 +0100 @@ -91,8 +91,13 @@ CMPIStatus enum_alloc_cap_instances(cons goto out; conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; + if (conn == NULL) { + if (id) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "Requested Object could not be found."); + goto out; + } s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); if (s.rc != CMPI_RC_OK) {

Heidi Eckhart wrote:
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201175805 -3600 # Node ID 70dedb925282ed3ceccf95872537204a1531c777 # Parent 65e42d8fd81f65e561b32c99189e9940e0556d00 AllocationCapabilities getInstance seg faults on KVM system with Xen request
wbemgi 'http://localhost:5988/root/virt:Xen_AllocationCapabilities.InstanceID="ProcessorPool/0"' on a KVM system seg faults, as not the appropriate error code is set. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com>
diff -r 65e42d8fd81f -r 70dedb925282 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:43 2008 +0100 +++ b/src/Virt_AllocationCapabilities.c Thu Jan 24 12:56:45 2008 +0100 @@ -91,8 +91,13 @@ CMPIStatus enum_alloc_cap_instances(cons goto out;
conn = connect_by_classname(broker, CLASSNAME(ref), &s); - if (conn == NULL) - goto out; + if (conn == NULL) { + if (id) + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "Requested Object could not be found."); + goto out; + }
s = get_all_pools(broker, conn, NAMESPACE(ref), &device_pool_list); if (s.rc != CMPI_RC_OK) {
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
And a good catch here too. +1 -- -Jay
participants (2)
-
Heidi Eckhart
-
Jay Gagnon