[Libvirt-cim] [PATCH 2 of 2] Added association SAPAvailableForElement (ComputerSystem <-> KVMRedirectionSAP)

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 15 16:29:26 UTC 2008


> +static CMPIStatus host_to_sapavail(const CMPIObjectPath *ref,
> +                                   struct std_assoc_info *info,
> +                                   struct inst_list *list)
> +{
> +        CMPIStatus s = {CMPI_RC_OK, NULL};
> +        CMPIInstance *instance = NULL;
> +
> +        if (!match_hypervisor_prefix(ref, info))
> +                goto out;
> +
> +        s = get_domain_by_ref(_BROKER, ref, &instance);
> +        if (s.rc != CMPI_RC_OK) 
> +                goto out; 
> +
> +        s = enum_console_sap(_BROKER, ref, list);

This is returning all of the SAPs on the system.  You want to return 
just those SAPs that correspond to the guest reference that is passed in.

The output on my system:

wbemcli ain -ac KVM_SAPAvailableForElement 
'http://localhost/root/virt:KVM_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="test2"'

elm3b41/root/virt:KVM_KVMRedirectionSAP.CreationClassName="KVM_KVMRedirectionSAP",Name="-1:-1",SystemCreationClassName="KVM_ComputerSystem",SystemName="test"
elm3b41/root/virt:KVM_KVMRedirectionSAP.CreationClassName="KVM_KVMRedirectionSAP",Name="-1:-1",SystemCreationClassName="KVM_ComputerSystem",SystemName="test2"

> +
> + out:
> +        return s;
> +}
> +
> +LIBVIRT_CIM_DEFAULT_MAKEREF()
> +
> +static char* managedelem[] = {
> +        "Xen_ComputerSystem",
> +        "KVM_ComputerSystem",
> +        "LXC_ComputerSystem",
> +        "Linux_ComputerSystem",

Linux_ComputerSystem isn't needed in this list.  It's only needed if 
you're associating the host class.

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list