
JG> +static CMPIStatus alloc_to_pool(const CMPIObjectPath *ref, JG> + struct std_assoc_info *info, JG> + struct inst_list *list) JG> +{ JG> + /* Pool to alloc is more important. That will be done first. */ JG> + return (CMPIStatus){CMPI_RC_OK, NULL}; JG> +} If we're going to leave this out for now, this should instead be RETURN_UNSUPPORTED(). However, since the InstanceID of a pool and an AllocationCapabilities are the same, isn't this behavior the same as below? If you set the below function to be the handler for the alloc_to_pool case, won't it behave as expected? JG> +static CMPIStatus pool_to_alloc(const CMPIObjectPath *ref, JG> + struct std_assoc_info *info, JG> + struct inst_list *list) JG> +{ JG> + int ret; JG> + char *inst_id; JG> + uint16_t type; JG> + CMPIInstance *inst = NULL; JG> + CMPIStatus s = {CMPI_RC_OK}; JG> + JG> + inst_id = cu_get_str_path(ref, "InstanceID"); JG> + if (inst_id == NULL) { JG> + CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, JG> + "Could not get InstanceID."); JG> + goto out; JG> + } JG> + JG> + inst = get_typed_instance(_BROKER, "AllocationCapabilities", JG> + NAMESPACE(ref)); JG> + CMSetProperty(inst, "InstanceID", inst_id, CMPI_chars); JG> + JG> + ret = cu_get_u16_path(ref, "ResourceType", &type); JG> + if (ret != 1) { JG> + CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, JG> + "Could not get ResourceType."); JG> + goto out; JG> + } JG> + CMSetProperty(inst, "ResourceType", &type, CMPI_uint16); JG> + JG> + inst_list_add(list, inst); JG> + JG> + out: JG> + free(inst_id); JG> + JG> + return s; JG> +} This brings up an idea. Maybe it would be helpful for libcmpiutil to have a function that copies a value from a ref to an instance, or from an instance to an instance. This would assume that they're the same type, of course, but the above would be much shorter if we had something like: cu_copy_key(&ref, &inst, "InstanceID"); cu_copy_key(&ref, &inst, "ResourceType"); Right? I know there are a couple other places where we need to do that, so it might be worth knocking something up. Should be trivial and easy. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com