
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197410852 28800 # Node ID 8761c7b39ea87feb54f89e41e1a7044104ec9399 # Parent 6c3ca59055416d7bb07716d3a750800e6087878e #2 GetInstance() does not return an instance that matches the instanceID given. Updates - removed boolean and now use a string, get instanceID in GetInstance() call instead. Add a argument to return_ele_cap() that handles the GetInstance(). If this argument is set, get the InstanceID from the ref. In the loop that walks through the domains on the system, check to see if this id matches one of the names returned. If there is a match, create the instance and then exit from the loop. If no match is found, an error is returned. Failing query: wbemcli gi http://localhost:5988/root/virt:Xen_EnabledLogicalElementCapabilities.InstanceID="kaitlin_test" localhost:5988/root/virt:Xen_EnabledLogicalElementCapabilities.InstanceID="kaitlin_test" Caption,Description,InstanceID="hd_domain",ElementName,ElementNameEditSupported=FALSE,MaxElementNameLen,RequestedStatesSupported=2,3,9,10,11,ElementNameMask,StateAwareness,CreationClassName="Xen_EnabledLogicalElementCapabilities" Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 6c3ca5905541 -r 8761c7b39ea8 src/Virt_EnabledLogicalElementCapabilities.c --- a/src/Virt_EnabledLogicalElementCapabilities.c Tue Dec 11 09:42:24 2007 -0800 +++ b/src/Virt_EnabledLogicalElementCapabilities.c Tue Dec 11 14:07:32 2007 -0800 @@ -21,6 +21,7 @@ */ #include <stdlib.h> #include <unistd.h> +#include <string.h> #include <cmpidt.h> #include <cmpift.h> @@ -135,7 +136,8 @@ CMPIStatus get_ele_cap(const CMPIBroker static CMPIStatus return_ele_cap(const CMPIObjectPath *ref, const CMPIResult *results, - int names_only) + int names_only, + const char *id) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; @@ -162,6 +164,9 @@ static CMPIStatus return_ele_cap(const C goto end; } + if (id && (!STREQ(name, id))) + goto end; + s = get_ele_cap(_BROKER, ref, name, &inst); if (s.rc != CMPI_RC_OK) goto end; @@ -174,7 +179,7 @@ static CMPIStatus return_ele_cap(const C end: virDomainFree(list[i]); - if (s.rc != CMPI_RC_OK) + if ((s.rc != CMPI_RC_OK) || (id && (STREQ(name, id)))) goto out; } @@ -191,7 +196,7 @@ static CMPIStatus EnumInstanceNames(CMPI const CMPIResult *results, const CMPIObjectPath *reference) { - return return_ele_cap(reference, results, 1); + return return_ele_cap(reference, results, 1, NULL); } static CMPIStatus EnumInstances(CMPIInstanceMI *self, @@ -201,7 +206,7 @@ static CMPIStatus EnumInstances(CMPIInst const char **properties) { - return return_ele_cap(reference, results, 0); + return return_ele_cap(reference, results, 0, NULL); } static CMPIStatus GetInstance(CMPIInstanceMI *self, @@ -210,7 +215,17 @@ static CMPIStatus GetInstance(CMPIInstan const CMPIObjectPath *reference, const char **properties) { - return return_ele_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; + } + + return return_ele_cap(reference, results, 0, id); } DEFAULT_CI();

KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1197410852 28800 KR> # Node ID 8761c7b39ea87feb54f89e41e1a7044104ec9399 KR> # Parent 6c3ca59055416d7bb07716d3a750800e6087878e KR> #2 GetInstance() does not return an instance that matches the KR> instanceID given. I like this much better. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197410852 28800 # Node ID 8761c7b39ea87feb54f89e41e1a7044104ec9399 # Parent 6c3ca59055416d7bb07716d3a750800e6087878e #2 GetInstance() does not return an instance that matches the instanceID given.
Updates - removed boolean and now use a string, get instanceID in GetInstance() call instead.
Add a argument to return_ele_cap() that handles the GetInstance(). If this argument is set, get the InstanceID from the ref. In the loop that walks through the domains on the system, check to see if this id matches one of the names returned. If there is a match, create the instance and then exit from the loop.
If no match is found, an error is returned.
Failing query: wbemcli gi http://localhost:5988/root/virt:Xen_EnabledLogicalElementCapabilities.InstanceID="kaitlin_test"
localhost:5988/root/virt:Xen_EnabledLogicalElementCapabilities.InstanceID="kaitlin_test" Caption,Description,InstanceID="hd_domain",ElementName,ElementNameEditSupported=FALSE,MaxElementNameLen,RequestedStatesSupported=2,3,9,10,11,ElementNameMask,StateAwareness,CreationClassName="Xen_EnabledLogicalElementCapabilities"
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
Good patch and all, but it looks like something about your commit message is making it treat the "#2 GetInstance()..." as a comment, hence the blank subject line. Ah. I just looked back at our other "#foo" patches, and it looks like they have all been patchsets or [RFC] type patches, so no actual patch (until this one) has had its commit message start with the pound sign. I guess we'll have to revise the guidelines a little. Any suggestions? -- -Jay

Jay Gagnon wrote:
Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1197410852 28800 # Node ID 8761c7b39ea87feb54f89e41e1a7044104ec9399 # Parent 6c3ca59055416d7bb07716d3a750800e6087878e #2 GetInstance() does not return an instance that matches the instanceID given.
Good patch and all, but it looks like something about your commit message is making it treat the "#2 GetInstance()..." as a comment, hence the blank subject line.
Ah. I just looked back at our other "#foo" patches, and it looks like they have all been patchsets or [RFC] type patches, so no actual patch (until this one) has had its commit message start with the pound sign. I guess we'll have to revise the guidelines a little. Any suggestions?
I was confused too when I saw the mail send without a subject. =) Dan suggested including a space before the pound sign. I'm not sure if that will work, but I can try next time I have to resubmit a patch. -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com
participants (3)
-
Dan Smith
-
Jay Gagnon
-
Kaitlin Rupert