
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196340636 -3600 # Node ID 559a1c5a58401f7437037cb54219dda6914e3c81 # Parent 3b849faf8ee17556ff39993a43ca3759f8604859 SDC: Adoption of changes to std_assoc struct in std_association This is the follow up patch to the API changes made in std_association. The struct std_assoc does now take lists for source, target and assoc classnames. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 3b849faf8ee1 -r 559a1c5a5840 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Thu Nov 29 13:44:46 2007 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Thu Nov 29 13:50:36 2007 +0100 @@ -811,16 +811,17 @@ static CMPIInstance *make_ref(const CMPI struct std_assoc_info *info, struct std_assoc *assoc) { - CMPIInstance *refinst; - char *base; - - base = class_base_name(assoc->assoc_class); - if (base == NULL) + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *refinst = NULL; + virConnectPtr conn = NULL; + + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + if (conn == NULL) return NULL; refinst = get_typed_instance(_BROKER, - CLASSNAME(ref), - base, + pfx_from_conn(conn), + "SettingsDefineCapabilities", NAMESPACE(ref)); if (refinst != NULL) { @@ -834,32 +835,50 @@ static CMPIInstance *make_ref(const CMPI (CMPIValue *)&instop, CMPI_ref); } - free(base); + virConnectClose(conn); return refinst; } +char* group_component[] = { + "Xen_AllocationCapabilities", + "KVM_AllocationCapabilities", + NULL +}; + +char* part_component[] = { + "Xen_ResourceAllocationSettingData", + "KVM_ResourceAllocationSettingData", + NULL +}; + +char* assoc_classname[] = { + "Xen_SettingsDefineCapabilities", + "KVM_SettingsDefineCapabilities", + NULL +}; + struct std_assoc _alloc_cap_to_rasd = { - .source_class = "CIM_AllocationCapabilities", + .source_class = (char**)&group_component, .source_prop = "GroupComponent", - .target_class = "CIM_ResourceAllocationSettingData", + .target_class = (char**)&part_component, .target_prop = "PartComponent", - .assoc_class = "CIM_SettingsDefineCapabilities", + .assoc_class = (char**)&assoc_classname, .handler = alloc_cap_to_rasd, .make_ref = make_ref }; struct std_assoc _rasd_to_alloc_cap = { - .source_class = "CIM_ResourceAllocationSettingData", + .source_class = (char**)&part_component, .source_prop = "PartComponent", - .target_class = "CIM_AllocationCapabilities", + .target_class = (char**)&group_component, .target_prop = "GroupComponent", - .assoc_class = "CIM_SettingsDefineCapabilities", + .assoc_class = (char**)&assoc_classname, .handler = rasd_to_alloc_cap, .make_ref = make_ref