[Libvirt-cim] [PATCH 3 of 3] Enhance handling of input parameter of std_association logic

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Nov 29 17:50:57 UTC 2007


Heidi Eckhart wrote:

Sorry for revisiting this patch.  I failed to test references yesterday, 
so I didn't catch this problem then.
>  static struct std_assoc *
>  std_assoc_get_handler(const struct std_assoc_ctx *ctx,
> +                      struct std_assoc_info *info,
>                        const CMPIObjectPath *ref)
>  {
>   
<snip>
> +
> +        if (info->assoc_class) {
> +                CU_DEBUG("Check client's assocClass: '%s'",
> +                         info->assoc_class);
> +                
> +                rc = match_class(ctx->brkr, 
> +                                 NAMESPACE(ref),  
> +                                 info->assoc_class,
> +                                 ptr->assoc_class);
> +                
> +                if (!rc) {
> +                        CU_DEBUG("AssocClass not valid.");
> +                        goto out;
> +                }
> +                CU_DEBUG("AssocClass valid.");
> +        }
> +        
> +        if (info->result_class) {
> +                CU_DEBUG("Check client's resultClass: '%s'",
> +                         info->result_class);
> +                
> +                rc = match_class(ctx->brkr, 
> +                                 NAMESPACE(ref), 
> +                                 info->result_class, 
> +                                 ptr->target_class);
> +                
> +                if (!rc) {
> +                        CU_DEBUG("ResultClass not valid.");
> +                        goto out;
> +                }
> +                CU_DEBUG("ResultClass valid.");
> +        }
This works for associations.  But for references, the result class is 
the association class name.  So, when you call std_assoc_get_handler() 
from do_ref(), you end up checking the client's result class (which is 
the association name) against the result class list instead of the 
association list.  Here's some sample debug:

std_association.c(152): Calling Provider: 
'associationVirt_HostedDependencyProvider'
std_association.c(182): Check client's resultClass: 'Xen_HostedDependency'
std_association.c(78): provider accepts Xen_ComputerSystem resultclass
std_association.c(78): provider accepts KVM_ComputerSystem resultclass
std_association.c(190): ResultClass not valid.
std_association.c(302): No handler found.

You could add flag argument to std_assoc_get_handler() that indicates 
whether the call is asking for references or an associators.  Although, 
I'm not sure that's the most elegant way.

Also, adding the debug messages that print which values the provider is 
checking the result class / assoc class / etc might be useful - that is, 
print out what classes the provider accepts.  Someone else can chime in 
as to whether this would be useful.

-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com





More information about the Libvirt-cim mailing list