[PATCH 00 of 12] #3 - Adoption of changes to std_assoc struct in std_association for all associations

Sorry saw Kaitlin's comments too late :(. 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. Diff tp patch set #1: - fixed SD: former patch specified HostSystem as group_component instead of ComputerSystem - fixed HS: class ResourcePoolConfigurationService was missing for dependent - fixed SDC: fixed check against CMPIRc in alloc_cap_to_rasd; this still needs to be fixed in another patch, as ResourceType is no key property but is handled as one Diff to patch set #2: - fixed RAFP: need to specify subclasses of ResourceAllocationSettingData - fixed: SDS: need to specify subclasses of ResourceAllocationSettingData - fixed VSSDC: need to specify subclasses of ResourceAllocationSettingData

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196333528 -3600 # Node ID af7ce48b18bed937d49df9d4073cac564c391971 # Parent c478a5b30689a80159588c8f914ac97263694372 ECTP: 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. It also adds the registration of ComputerSystem and HostSystem to the interop namespace. This is necessary to check the client's resultClass value. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r c478a5b30689 -r af7ce48b18be Makefile.am --- a/Makefile.am Wed Nov 28 11:06:22 2007 -0800 +++ b/Makefile.am Thu Nov 29 11:52:08 2007 +0100 @@ -36,6 +36,8 @@ MOFS = \ schema/ElementSettingData.mof INTEROP_MOFS = \ + schema/ComputerSystem.mof \ + schema/HostSystem.mof \ schema/RegisteredProfile.mof \ schema/ElementConformsToProfile.mof diff -r c478a5b30689 -r af7ce48b18be src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Wed Nov 28 11:06:22 2007 -0800 +++ b/src/Virt_ElementConformsToProfile.c Thu Nov 29 11:52:08 2007 +0100 @@ -222,27 +222,47 @@ static CMPIInstance *make_ref(const CMPI return assoc_inst; } +char* conformant_standard[] = { + "Xen_RegisteredProfile", + "KVM_RegisteredProfile", + NULL +}; + +char* managed_element[] = { + "Xen_HostSystem", + "Xen_ComputerSystem", + "KVM_HostSystem", + "KVM_ComputerSystem", + NULL +}; + +char* assoc_classname[] = { + "Xen_ElementConformsToProfile", + "KVM_ElementConformsToProfile", + NULL +}; + struct std_assoc forward = { - .source_class = "CIM_RegisteredProfile", + .source_class = (char**)&conformant_standard, .source_prop = "ConformantStandard", - .target_class = "CIM_ManagedElement", + .target_class = (char**)&managed_element, .target_prop = "ManagedElement", - .assoc_class = NULL, + .assoc_class = (char**)&assoc_classname, .handler = prof_to_elem, .make_ref = make_ref }; struct std_assoc backward = { - .source_class = "CIM_ManagedElement", + .source_class = (char**)&managed_element, .source_prop = "ManagedElement", - .target_class = "CIM_RegisteredProfile", + .target_class = (char**)&conformant_standard, .target_prop = "ConformantStandard", - .assoc_class = NULL, + .assoc_class = (char**)&assoc_classname, .handler = elem_to_prof, .make_ref = make_ref @@ -253,7 +273,6 @@ struct std_assoc *assoc_handlers[] = { &backward, NULL }; - STDA_AssocMIStub(, Virt_ElementConformsToProfileProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /*

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196334170 -3600 # Node ID d8dbe141c0b4a99c4ee0d380c8bcfe6abb6d8d66 # Parent af7ce48b18bed937d49df9d4073cac564c391971 EAFP: 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 af7ce48b18be -r d8dbe141c0b4 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Thu Nov 29 11:52:08 2007 +0100 +++ b/src/Virt_ElementAllocatedFromPool.c Thu Nov 29 12:02:50 2007 +0100 @@ -264,23 +264,57 @@ static CMPIInstance *make_ref(const CMPI return refinst; } +char* antecedent[] = { + "Xen_ProcessorPool", + "Xen_MemoryPool", + "Xen_NetworkPool", + "Xen_DiskPool", + "KVM_ProcessorPool", + "KVM_MemoryPool", + "KVM_NetworkPool", + "KVM_DiskPool", + NULL +}; + +char* dependent[] = { + "Xen_Processor", + "Xen_Memory", + "Xen_Network", + "Xen_Disk", + "KVM_Processor", + "KVM_Memory", + "KVM_Network", + "KVM_Disk", + NULL +}; + +char* assoc_classname[] = { + "Xen_ElementAllocatedFromPool", + "KVM_ElementAllocatedFromPool", + NULL +}; + static struct std_assoc _vdev_to_pool = { - .source_class = "CIM_LogicalDevice", + .source_class = (char**)&dependent, .source_prop = "Dependent", - .target_class = "CIM_ResourcePool", + .target_class = (char**)&antecedent, .target_prop = "Antecedent", + + .assoc_class = (char**)&assoc_classname, .handler = vdev_to_pool, .make_ref = make_ref }; static struct std_assoc _pool_to_vdev = { - .source_class = "CIM_ResourcePool", + .source_class = (char**)&antecedent, .source_prop = "Antecedent", - .target_class = "CIM_LogicalDevice", + .target_class = (char**)&dependent, .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, .handler = pool_to_vdev, .make_ref = make_ref

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196338264 -3600 # Node ID 38068b513857c8cb64a3f5c808f0bd42e272dfb9 # Parent d8dbe141c0b4a99c4ee0d380c8bcfe6abb6d8d66 EC: 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 d8dbe141c0b4 -r 38068b513857 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Thu Nov 29 12:02:50 2007 +0100 +++ b/src/Virt_ElementCapabilities.c Thu Nov 29 13:11:04 2007 +0100 @@ -237,21 +237,23 @@ static CMPIStatus pool_to_alloc(const CM out: return s; } + static CMPIInstance *make_ref(const CMPIObjectPath *ref, const CMPIInstance *inst, 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), + "ElementCapabilities", NAMESPACE(ref)); if (refinst != NULL) { @@ -265,109 +267,146 @@ static CMPIInstance *make_ref(const CMPI (CMPIValue *)&instop, CMPI_ref); } - free(base); + virConnectClose(conn); return refinst; } +char* assoc_classname[] = { + "Xen_ElementCapabilities", + "KVM_ElementCapabilities", + NULL +}; + +char* host_system[] = { + "Xen_HostSystem", + "KVM_HostSystem", + NULL +}; + +char* virtual_system_management_capabilities[] = { + "Xen_VirtualSystemManagementCapabilities", + "KVM_VirtualSystemManagementCapabilities", + NULL +}; + struct std_assoc system_to_vsm_cap = { - .source_class = "CIM_System", + .source_class = (char**)&host_system, .source_prop = "ManagedElement", - .target_class = "CIM_VirtualSystemManagementCapabilities", + .target_class = (char**)&virtual_system_management_capabilities, .target_prop = "Capabilities", - .assoc_class = "CIM_ElementCapabilities", + .assoc_class = (char**)&assoc_classname, .handler = sys_to_cap, .make_ref = make_ref }; struct std_assoc vsm_cap_to_system = { - .source_class = "CIM_VirtualSystemManagementCapabilities", + .source_class = (char**)&virtual_system_management_capabilities, .source_prop = "Capabilities", - .target_class = "CIM_System", + .target_class = (char**)&host_system, .target_prop = "ManagedElement", - .assoc_class = "CIM_ElementCapabilities", + .assoc_class = (char**)&assoc_classname, .handler = cap_to_sys, .make_ref = make_ref }; -struct std_assoc xen_cs_to_ele_cap = { - .source_class = "Xen_ComputerSystem", +char* computer_system[] = { + "Xen_ComputerSystem", + "KVM_ComputerSystem", + NULL +}; + +char* enabled_logical_element_capabilities[] = { + "Xen_EnabledLogicalElementCapabilities", + "KVM_EnabledLogicalElementCapabilities", + NULL +}; + +struct std_assoc ele_cap_to_cs = { + .source_class = (char**)&enabled_logical_element_capabilities, + .source_prop = "Capabilities", + + .target_class = (char**)&computer_system, + .target_prop = "ManagedElement", + + .assoc_class = (char**)&assoc_classname, + + .handler = cap_to_cs, + .make_ref = make_ref +}; + +struct std_assoc cs_to_ele_cap = { + .source_class = (char**)&computer_system, .source_prop = "ManagedElement", - .target_class = "CIM_EnabledLogicalElementCapabilities", + .target_class = (char**)&enabled_logical_element_capabilities, .target_prop = "Capabilities", - .assoc_class = "CIM_ElementCapabilities", + .assoc_class = (char**)&assoc_classname, .handler = cs_to_cap, .make_ref = make_ref }; -struct std_assoc kvm_cs_to_ele_cap = { - .source_class = "KVM_ComputerSystem", +char* allocation_capabilities[] = { + "Xen_AllocationCapabilities", + "KVM_AllocationCapabilities", + NULL +}; + +char* resource_pool[] = { + "Xen_ProcessorPool", + "Xen_MemoryPool", + "Xen_NetworkPool", + "Xen_DiskPool", + "KVM_ProcessorPool", + "KVM_MemoryPool", + "KVM_NetworkPool", + "KVM_DiskPool", + NULL +}; + +struct std_assoc alloc_cap_to_resource_pool = { + .source_class = (char**)&allocation_capabilities, + .source_prop = "Capabilities", + + .target_class = (char**)&resource_pool, + .target_prop = "ManagedElement", + + .assoc_class = (char**)&assoc_classname, + + .handler = alloc_to_pool, + .make_ref = make_ref +}; + +struct std_assoc resource_pool_to_alloc_cap = { + .source_class = (char**)&resource_pool, .source_prop = "ManagedElement", - .target_class = "CIM_EnabledLogicalElementCapabilities", + .target_class = (char**)&allocation_capabilities, .target_prop = "Capabilities", - .assoc_class = "CIM_ElementCapabilities", - - .handler = cs_to_cap, - .make_ref = make_ref -}; - -struct std_assoc ele_cap_to_computer_system = { - .source_class = "CIM_EnabledLogicalElementCapabilities", - .source_prop = "Capabilities", - - .target_class = "CIM_ComputerSystem", - .target_prop = "ManagedElement", - - .assoc_class = "CIM_ElementCapabilities", - - .handler = cap_to_cs, - .make_ref = make_ref -}; - -struct std_assoc alloc_cap_to_resource_pool = { - .source_class = "CIM_AllocationCapabilities", - .source_prop = "Capabilities", - - .target_class = "CIM_ResourcePool", - .target_prop = "ManagedElement", - - .handler = alloc_to_pool, - .make_ref = make_ref -}; - -struct std_assoc resource_pool_to_alloc_cap = { - .source_class = "CIM_ResourcePool", - .source_prop = "ManagedElement", - - .target_class = "CIM_AllocationCapabilities", - .target_prop = "Capabilities", + .assoc_class = (char**)&assoc_classname, .handler = pool_to_alloc, .make_ref = make_ref }; struct std_assoc *assoc_handlers[] = { - &xen_cs_to_ele_cap, - &kvm_cs_to_ele_cap, &system_to_vsm_cap, &vsm_cap_to_system, - &ele_cap_to_computer_system, + &ele_cap_to_cs, + &cs_to_ele_cap, &alloc_cap_to_resource_pool, &resource_pool_to_alloc_cap, NULL }; - STDA_AssocMIStub(, Xen_ElementCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers); STDA_AssocMIStub(, KVM_ElementCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers);

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196339009 -3600 # Node ID 36e16117e8b18e85a4898879091b919074dc44dc # Parent 38068b513857c8cb64a3f5c808f0bd42e272dfb9 ESD: 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 38068b513857 -r 36e16117e8b1 src/Virt_ElementSettingData.c --- a/src/Virt_ElementSettingData.c Thu Nov 29 13:11:04 2007 +0100 +++ b/src/Virt_ElementSettingData.c Thu Nov 29 13:23:29 2007 +0100 @@ -129,17 +129,18 @@ static CMPIInstance *make_ref(const CMPI struct std_assoc_info *info, struct std_assoc *assoc) { + CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *refinst = NULL; - char *base; + virConnectPtr conn = NULL; uint16_t prop_value = 1; - base = class_base_name(assoc->assoc_class); - if (base == NULL) - goto out; + 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), + "ElementSettingData", NAMESPACE(ref)); if (refinst != NULL) { @@ -165,33 +166,55 @@ static CMPIInstance *make_ref(const CMPI (CMPIValue *)&prop_value, CMPI_uint16); } -out: - free(base); + virConnectClose(conn); return refinst; } +char* virtual_system_setting_data[] = { + "Xen_VirtualSystemSettingData", + "KVM_VirtualSystemSettingData", + NULL +}; + +char* resource_allocation_setting_data[] = { + "Xen_ResourceAllocationSettingData", + "KVM_ResourceAllocationSettingData", + NULL +}; + +char* managed_element[] = { + "CIM_ManagedElement", + NULL +}; + +char* assoc_classname[] = { + "Xen_ElementSettingData", + "KVM_ElementSettingData", + NULL +}; + static struct std_assoc _vssd_to_vssd = { - .source_class = "CIM_VirtualSystemSettingData", + .source_class = (char**)&virtual_system_setting_data, .source_prop = "ManagedElement", - .target_class = "CIM_ManagedElement", + .target_class = (char**)&managed_element, .target_prop = "SettingData", - .assoc_class = "CIM_ElementSettingData", + .assoc_class = (char**)&assoc_classname, .handler = vssd_to_vssd, .make_ref = make_ref }; static struct std_assoc _rasd_to_rasd = { - .source_class = "CIM_ResourceAllocationSettingData", + .source_class = (char**)&resource_allocation_setting_data, .source_prop = "ManagedElement", - .target_class = "CIM_ManagedElement", + .target_class = (char**)&managed_element, .target_prop = "SettingData", - .assoc_class = "CIM_ElementSettingData", + .assoc_class = (char**)&assoc_classname, .handler = rasd_to_rasd, .make_ref = make_ref

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196339320 -3600 # Node ID 69f4e34c1187ac9013cf779f78c2831544b4a5a4 # Parent 36e16117e8b18e85a4898879091b919074dc44dc HD: 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 36e16117e8b1 -r 69f4e34c1187 src/Virt_HostedDependency.c --- a/src/Virt_HostedDependency.c Thu Nov 29 13:23:29 2007 +0100 +++ b/src/Virt_HostedDependency.c Thu Nov 29 13:28:40 2007 +0100 @@ -99,55 +99,54 @@ static CMPIInstance *make_ref(const CMPI return refinst; } -static struct std_assoc xen_vs_to_host = { - .source_class = "Xen_ComputerSystem", +char* antecedent[] = { + "Xen_ComputerSystem", + "KVM_ComputerSystem", + NULL +}; + +char* dependent[] = { + "Xen_HostSystem", + "KVM_HostSystem", + NULL +}; + +char* assoc_classname[] = { + "Xen_HostedDependency", + "KVM_HostedDependency", + NULL +}; + +static struct std_assoc _vs_to_host = { + .source_class = (char**)&antecedent, .source_prop = "Antecedent", - .target_class = "Xen_HostSystem", - .source_prop = "Dependent", + .target_class = (char**)&dependent, + .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, .handler = vs_to_host, .make_ref = make_ref }; -static struct std_assoc kvm_vs_to_host = { - .source_class = "KVM_ComputerSystem", - .source_prop = "Antecedent", - - .target_class = "KVM_HostSystem", +static struct std_assoc _host_to_vs = { + .source_class = (char**)&dependent, .source_prop = "Dependent", - .handler = vs_to_host, - .make_ref = make_ref -}; + .target_class = (char**)&antecedent, + .target_prop = "Antecedent", -static struct std_assoc xen_host_to_vs = { - .source_class = "Xen_HostSystem", - .source_prop = "Dependent", - - .target_class = "Xen_ComputerSystem", - .target_prop = "Antecedent", + .assoc_class = (char**)&assoc_classname, .handler = host_to_vs, .make_ref = make_ref }; -static struct std_assoc kvm_host_to_vs = { - .source_class = "KVM_HostSystem", - .source_prop = "Dependent", - - .target_class = "KVM_ComputerSystem", - .target_prop = "Antecedent", - - .handler = host_to_vs, - .make_ref = make_ref -}; static struct std_assoc *handlers[] = { - &xen_vs_to_host, - &xen_host_to_vs, - &kvm_vs_to_host, - &kvm_host_to_vs, + &_vs_to_host, + &_host_to_vs, NULL };

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196339597 -3600 # Node ID 8a75970ed83c888e50b7b83360078c8ab32316db # Parent 69f4e34c1187ac9013cf779f78c2831544b4a5a4 HRP: 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 69f4e34c1187 -r 8a75970ed83c src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Thu Nov 29 13:28:40 2007 +0100 +++ b/src/Virt_HostedResourcePool.c Thu Nov 29 13:33:17 2007 +0100 @@ -119,27 +119,51 @@ static CMPIInstance *make_ref(const CMPI return refinst; } +char* group_component[] = { + "Xen_HostSystem", + "KVM_HostSystem", + NULL +}; + +char* part_component[] = { + "Xen_ProcessorPool", + "Xen_MemoryPool", + "Xen_NetworkPool", + "Xen_DiskPool", + "KVM_ProcessorPool", + "KVM_MemoryPool", + "KVM_NetworkPool", + "KVM_DiskPool", + NULL +}; + +char* assoc_classname[] = { + "Xen_HostedResourcePool", + "KVM_HostedResourcePool", + NULL +}; + struct std_assoc forward = { - .source_class = "CIM_ResourcePool", + .source_class = (char**)&part_component, .source_prop = "PartComponent", - .target_class = "CIM_System", + .target_class = (char**)&group_component, .target_prop = "GroupComponent", - .assoc_class = NULL, + .assoc_class = (char**)&assoc_classname, .handler = pool_to_sys, .make_ref = make_ref }; struct std_assoc backward = { - .source_class = "CIM_System", + .source_class = (char**)&group_component, .source_prop = "GroupComponent", - .target_class = "CIM_ResourcePool", + .target_class = (char**)&part_component, .target_prop = "PartComponent", - .assoc_class = NULL, + .assoc_class = (char**)&assoc_classname, .handler = sys_to_pool, .make_ref = make_ref

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196416046 -3600 # Node ID 7ed5aecb4249c6d18b412262ab0362c220b4f95e # Parent 8a75970ed83c888e50b7b83360078c8ab32316db HS: 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 8a75970ed83c -r 7ed5aecb4249 src/Virt_HostedService.c --- a/src/Virt_HostedService.c Thu Nov 29 13:33:17 2007 +0100 +++ b/src/Virt_HostedService.c Fri Nov 30 10:47:26 2007 +0100 @@ -81,16 +81,17 @@ static CMPIInstance *make_ref(const CMPI struct std_assoc_info *info, struct std_assoc *assoc) { + CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *refinst = NULL; - char *base; + virConnectPtr conn = NULL; - base = class_base_name(assoc->assoc_class); - if (base == NULL) - goto out; + 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), + "HostedService", NAMESPACE(ref)); if (refinst != NULL) { @@ -101,67 +102,60 @@ static CMPIInstance *make_ref(const CMPI set_reference(assoc, refinst, ref, instop); } -out: + virConnectClose(conn); + return refinst; } -static struct std_assoc xen_host_to_service = { - .source_class = "Xen_HostSystem", +char* antecedent[] = { + "Xen_HostSystem", + "KVM_HostSystem", + NULL +}; + +char* dependent[] = { + "Xen_ResourcePoolConfigurationService", + "Xen_VirtualSystemManagementService", + "KVM_ResourcePoolConfigurationService", + "KVM_VirtualSystemManagementService", + NULL +}; + +char* assoc_classname[] = { + "Xen_HostedService", + "KVM_HostedService", + NULL +}; + +static struct std_assoc _host_to_service = { + .source_class = (char**)&antecedent, .source_prop = "Antecedent", - .target_class = "CIM_ManagedElement", + .target_class = (char**)&dependent, .target_prop = "Dependent", - .assoc_class = "CIM_HostedService", + .assoc_class = (char**)&assoc_classname, .handler = host_to_service, .make_ref = make_ref }; -static struct std_assoc xen_service_to_host = { - .source_class = "CIM_Service", +static struct std_assoc _service_to_host = { + .source_class = (char**)&dependent, .source_prop = "Dependent", - - .target_class = "CIM_ManagedElement", + + .target_class = (char**)&antecedent, .target_prop = "Antecedent", - .assoc_class = "CIM_HostedService", - - .handler = service_to_host, - .make_ref = make_ref -}; - -static struct std_assoc kvm_host_to_service = { - .source_class = "KVM_HostSystem", - .source_prop = "Antecedent", - - .target_class = "CIM_Service", - .target_prop = "Dependent", - - .assoc_class = "CIM_HostedService", - - .handler = host_to_service, - .make_ref = make_ref -}; - -static struct std_assoc kvm_service_to_host = { - .source_class = "CIM_Service", - .source_prop = "Dependent", - - .target_class = "KVM_ComputerSystem", - .target_prop = "Antecedent", - - .assoc_class = "CIM_HostedService", - + .assoc_class = (char**)&assoc_classname, + .handler = service_to_host, .make_ref = make_ref }; static struct std_assoc *handlers[] = { - &xen_host_to_service, - &xen_service_to_host, - &kvm_host_to_service, - &kvm_service_to_host, + &_host_to_service, + &_service_to_host, NULL };

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196419032 -3600 # Node ID bd0565db204f6352a131f8bae8d51bea4e37646c # Parent 7ed5aecb4249c6d18b412262ab0362c220b4f95e RAFP: 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 7ed5aecb4249 -r bd0565db204f src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Fri Nov 30 10:47:26 2007 +0100 +++ b/src/Virt_ResourceAllocationFromPool.c Fri Nov 30 11:37:12 2007 +0100 @@ -243,23 +243,57 @@ static CMPIInstance *make_ref(const CMPI return refinst; } +char* antecedent[] = { + "Xen_ProcessorPool", + "Xen_MemoryPool", + "Xen_NetworkPool", + "Xen_DiskPool", + "KVM_ProcessorPool", + "KVM_MemoryPool", + "KVM_NetworkPool", + "KVM_DiskPool", + NULL +}; + +char* dependent[] = { + "Xen_DiskResourceAllocationSettingData", + "Xen_MemResourceAllocationSettingData", + "Xen_NetResourceAllocationSettingData", + "Xen_ProcResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", + "KVM_NetResourceAllocationSettingData", + "KVM_ProcResourceAllocationSettingData", + NULL +}; + +char* assoc_classname[] = { + "Xen_ResourceAllocationFromPool", + "KVM_ResourceAllocationFromPool", + NULL +}; + static struct std_assoc _rasd_to_pool = { - .source_class = "CIM_ResourceAllocationSettingData", + .source_class = (char**)&dependent, .source_prop = "Dependent", - - .target_class = "CIM_ResourcePool", + + .target_class = (char**)&antecedent, .target_prop = "Antecedent", + + .assoc_class = (char**)&assoc_classname, .handler = rasd_to_pool, .make_ref = make_ref }; static struct std_assoc _pool_to_rasd = { - .source_class = "CIM_ResourcePool", + .source_class = (char**)&antecedent, .source_prop = "Antecedent", - .target_class = "CIM_ResourceAllocationSettingData", + .target_class = (char**)&dependent, .target_prop = "Dependent", + + .assoc_class = (char**)&assoc_classname, .handler = pool_to_rasd, .make_ref = make_ref

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196419147 -3600 # Node ID 16c4893ba44ccb86f83eaf0eef5ab54120775bce # Parent bd0565db204f6352a131f8bae8d51bea4e37646c 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 bd0565db204f -r 16c4893ba44c src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Fri Nov 30 11:37:12 2007 +0100 +++ b/src/Virt_SettingsDefineCapabilities.c Fri Nov 30 11:39:07 2007 +0100 @@ -782,7 +782,7 @@ static CMPIStatus alloc_cap_to_rasd(cons CU_DEBUG("Getting ResourceType."); ret = cu_get_u16_path(ref, "ResourceType", &type); - if (ret != 1) { + if (ret != CMPI_RC_OK) { CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED, "Could not get ResourceType."); goto out; @@ -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

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196419213 -3600 # Node ID 504aece866fe3012cc9aaf64f8f1225dc76ab5e0 # Parent 16c4893ba44ccb86f83eaf0eef5ab54120775bce SDS: 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 16c4893ba44c -r 504aece866fe src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Fri Nov 30 11:39:07 2007 +0100 +++ b/src/Virt_SettingsDefineState.c Fri Nov 30 11:40:13 2007 +0100 @@ -301,33 +301,79 @@ static CMPIInstance *make_ref(const CMPI return refinst; } +char* logical_device[] = { + "Xen_Processor", + "Xen_Memory", + "Xen_Network", + "Xen_Disk", + "KVM_Processor", + "KVM_Memory", + "KVM_Network", + "KVM_Disk", + NULL +}; + +char* resource_allocation_setting_data[] = { + "Xen_DiskResourceAllocationSettingData", + "Xen_MemResourceAllocationSettingData", + "Xen_NetResourceAllocationSettingData", + "Xen_ProcResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", + "KVM_NetResourceAllocationSettingData", + "KVM_ProcResourceAllocationSettingData", + NULL +}; + +char* computer_system[] = { + "Xen_ComputerSystem", + "KVM_ComputerSystem", + NULL +}; + +char* virtual_system_setting_data[] = { + "Xen_VirtualSystemSettingData", + "KVM_VirtualSystemSettingData", + NULL +}; + +char* assoc_classname[] = { + "Xen_SettingsDefineState", + "KVM_SettingsDefineState", + NULL +}; + static struct std_assoc _dev_to_rasd = { - .source_class = "CIM_LogicalDevice", + .source_class = (char**)&logical_device, .source_prop = "ManagedElement", - .target_class = "CIM_ResourceAllocationSettingData", + .target_class = (char**)&resource_allocation_setting_data, .target_prop = "SettingData", + + .assoc_class = (char**)&assoc_classname, .handler = dev_to_rasd, .make_ref = make_ref }; static struct std_assoc _rasd_to_dev = { - .source_class = "CIM_ResourceAllocationSettingData", + .source_class = (char**)&resource_allocation_setting_data, .source_prop = "SettingData", - .target_class = "CIM_LogicalDevice", + .target_class = (char**)&logical_device, .target_prop = "ManagedElement", + + .assoc_class = (char**)&assoc_classname, .handler = rasd_to_dev, .make_ref = make_ref }; static struct std_assoc _vs_to_vssd = { - .source_class = "CIM_ComputerSystem", + .source_class = (char**)&computer_system, .source_prop = "ManagedElement", - .target_class = "CIM_VirtualSystemSettingData", + .target_class = (char**)&virtual_system_setting_data, .target_prop = "SettingData", .handler = vs_to_vssd, @@ -335,10 +381,10 @@ static struct std_assoc _vs_to_vssd = { }; static struct std_assoc _vssd_to_vs = { - .source_class = "CIM_VirtualSystemSettingData", + .source_class = (char**)&virtual_system_setting_data, .source_prop = "SettingData", - .target_class = "CIM_ComputerSystem", + .target_class = (char**)&computer_system, .target_prop = "ManagedElement", .handler = vssd_to_vs,

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196419221 -3600 # Node ID b04cad2f19903e872d08c0af80a1d5e9905f7534 # Parent 504aece866fe3012cc9aaf64f8f1225dc76ab5e0 SD: 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 504aece866fe -r b04cad2f1990 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Fri Nov 30 11:40:13 2007 +0100 +++ b/src/Virt_SystemDevice.c Fri Nov 30 11:40:21 2007 +0100 @@ -244,23 +244,51 @@ static CMPIStatus dev_to_sys(const CMPIO return s; } +char* group_component[] = { + "Xen_ComputerSystem", + "KVM_ComputerSystem", + NULL +}; + +char* part_component[] = { + "Xen_Processor", + "Xen_Memory", + "Xen_Network", + "Xen_Disk", + "KVM_Processor", + "KVM_Memory", + "KVM_Network", + "KVM_Disk", + NULL +}; + +char* assoc_classname[] = { + "Xen_SystemDevice", + "KVM_SystemDevice", + NULL +}; + static struct std_assoc forward = { - .source_class = "CIM_System", + .source_class = (char**)&group_component, .source_prop = "GroupComponent", - .target_class = "CIM_LogicalDevice", + .target_class = (char**)&part_component, .target_prop = "PartComponent", + + .assoc_class = (char**)&assoc_classname, .handler = sys_to_dev, .make_ref = make_ref }; static struct std_assoc backward = { - .source_class = "CIM_LogicalDevice", + .source_class = (char**)&part_component, .source_prop = "PartComponent", - .target_class = "CIM_System", + .target_class = (char**)&group_component, .target_prop = "GroupComponent", + + .assoc_class = (char**)&assoc_classname, .handler = dev_to_sys, .make_ref = make_ref

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1196419221 -3600 # Node ID 7e7c29393d458e982d894dcfbd379feb40f27d32 # Parent b04cad2f19903e872d08c0af80a1d5e9905f7534 VSSDC: 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 b04cad2f1990 -r 7e7c29393d45 src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Fri Nov 30 11:40:21 2007 +0100 +++ b/src/Virt_VSSDComponent.c Fri Nov 30 11:40:21 2007 +0100 @@ -173,23 +173,52 @@ static CMPIInstance *make_ref(const CMPI return refinst; } +char* group_component[] = { + "Xen_VirtualSystemSettingData", + "KVM_VirtualSystemSettingData", + NULL +}; + +char* part_component[] = { + "Xen_DiskResourceAllocationSettingData", + "Xen_MemResourceAllocationSettingData", + "Xen_NetResourceAllocationSettingData", + "Xen_ProcResourceAllocationSettingData", + "KVM_DiskResourceAllocationSettingData", + "KVM_MemResourceAllocationSettingData", + "KVM_NetResourceAllocationSettingData", + "KVM_ProcResourceAllocationSettingData", + NULL +}; + +char* assoc_classname[] = { + "Xen_VirtualSystemSettingDataComponent", + "KVM_VirtualSystemSettingDataComponent", + NULL +}; + + static struct std_assoc forward = { - .source_class = "CIM_VirtualSystemSettingData", + .source_class = (char**)&group_component, .source_prop = "GroupComponent", - .target_class = "CIM_ResourceAllocationSettingData", + .target_class = (char**)&part_component, .target_prop = "PartComponent", + + .assoc_class = (char**)&assoc_classname, .handler = vssd_to_rasd, .make_ref = make_ref }; static struct std_assoc backward = { - .source_class = "CIM_ResourceAllocationSettingData", + .source_class = (char**)&part_component, .source_prop = "PartComponent", - .target_class = "CIM_VirtualSystemSettingData", + .target_class = (char**)&group_component, .target_prop = "GroupComponent", + + .assoc_class = (char**)&assoc_classname, .handler = rasd_to_vssd, .make_ref = make_ref

Heidi Eckhart wrote:
- fixed SDC: fixed check against CMPIRc in alloc_cap_to_rasd; this still needs to be fixed in another patch, as ResourceType is no key property but is handled as one
Is this what's causing SDC to return a "Unsupported device type." error? I had this on my list to investigate, but I'll hold off if you're looking into it. =)
Diff to patch set #2: - fixed RAFP: need to specify subclasses of ResourceAllocationSettingData - fixed: SDS: need to specify subclasses of ResourceAllocationSettingData - fixed VSSDC: need to specify subclasses of ResourceAllocationSettingData
This patchset looks great as well. =) +1 -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

Kaitlin Rupert wrote:
Heidi Eckhart wrote:
- fixed SDC: fixed check against CMPIRc in alloc_cap_to_rasd; this still needs to be fixed in another patch, as ResourceType is no key property but is handled as one Is this what's causing SDC to return a "Unsupported device type." error? I had this on my list to investigate, but I'll hold off if you're looking into it. =) Yes. Kaitlin, if you have time and would like to do it, it would be great if you can you investigate a bit on it ? I would like to have a look into the make_ref() (connect_by_classname) and match_hypervisor_prefix() patch sets for tomorrow.
-- Regards Heidi Eckhart Software Engineer Linux Technology Center - Open Hypervisor heidieck@linux.vnet.ibm.com ************************************************** IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Herbert Kircher Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

Heidi Eckhart wrote:
Kaitlin Rupert wrote:
Heidi Eckhart wrote:
- fixed SDC: fixed check against CMPIRc in alloc_cap_to_rasd; this still needs to be fixed in another patch, as ResourceType is no key property but is handled as one Is this what's causing SDC to return a "Unsupported device type." error? I had this on my list to investigate, but I'll hold off if you're looking into it. =) Yes. Kaitlin, if you have time and would like to do it, it would be great if you can you investigate a bit on it ? I would like to have a look into the make_ref() (connect_by_classname) and match_hypervisor_prefix() patch sets for tomorrow.
Sure, I'll add this to my list of things to investigate. =) -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

HE> This is the follow up patch to the API changes made in HE> std_association. The struct std_assoc does now take lists HE> for source, target and assoc classnames. Applied. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (3)
-
Dan Smith
-
Heidi Eckhart
-
Kaitlin Rupert