[Libvirt-cim] [PATCH 1 of 3] AC GetInstance() fails with a "Could not get ResourceType" error
Jay Gagnon
grendel at linux.vnet.ibm.com
Mon Dec 17 16:09:27 UTC 2007
Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1197677154 28800
> # Node ID 889611ecea877bb54fad494ece56b2e7fac2b98e
> # Parent 86999a1e8fac6f6cee5ca62a4005ca37759713ff
> AC GetInstance() fails with a "Could not get ResourceType" error.
>
> GetInstance() was calling return_alloc_cap(), which in turn called rasd_type_from_classname(). rasd_type_from_classname() is expecting the classname to be one of the supported RASD type classnames, but this doesn't match the AC classname.
>
> Instead, GetInstance() should only return an instance if the supplied InstanceID matches one of the existing instances. alloc_cap_instances() should be modified to take a InstanceID argument.
>
> Failing query:
> wbemcli gi 'http://localhost/root/virt:Xen_AllocationCapabilities.InstanceID="ProcessorPool/0"'
>
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>
> const char **properties)
> {
> - return return_alloc_cap(reference, results, 0);
> + CMPIStatus s = {CMPI_RC_OK, NULL};
> + const char* id;
> +
> + if (cu_get_str_path(reference, "InstanceID", &id) != CMPI_RC_OK) {
> + cu_statusf(_BROKER, &s,
> + CMPI_RC_ERR_FAILED,
> + "No InstanceID specified");
> + return s;
> + }
>
>
Just a general style thing here. Don't know if we've made it official
or not but most of the time we would use a "goto out;" type thing
there. Nothing big but if you need to resend to fix that segfault Heidi
found this would probably be worth changing for the sake of consistency.
--
-Jay
More information about the Libvirt-cim
mailing list