
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1195661851 28800 # Node ID 5c0b219865cd675d54d4a13230c549be93a4d144 # Parent 278c59f67cb1fe0520e8dfa7b118cd907e8f10a1 Adding the RASD related part. This is based on the Resource Allocation Profile. My understanding is that we are implementing a setup similar to Figure 3 on page 31. In this case, we'll use the same RASD instance for State as well as Defined. Updated to due to change in get_rasd_instance_from_ref(). Also updated structure and handler function names to avoid confusion. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 278c59f67cb1 -r 5c0b219865cd src/Makefile.am --- a/src/Makefile.am Tue Nov 20 16:26:00 2007 -0500 +++ b/src/Makefile.am Wed Nov 21 08:17:31 2007 -0800 @@ -135,4 +135,4 @@ libVirt_HostedService_la_LIBADD = -lVirt libVirt_ElementSettingData_la_DEPENDENCIES = libVirt_VSSD.la libVirt_ElementSettingData_la_SOURCES = Virt_ElementSettingData.c -libVirt_ElementSettingData_la_LIBADD = -lVirt_VSSD +libVirt_ElementSettingData_la_LIBADD = -lVirt_VSSD -lVirt_RASD diff -r 278c59f67cb1 -r 5c0b219865cd src/Virt_ElementSettingData.c --- a/src/Virt_ElementSettingData.c Tue Nov 20 16:26:00 2007 -0500 +++ b/src/Virt_ElementSettingData.c Wed Nov 21 08:17:31 2007 -0800 @@ -31,12 +31,13 @@ #include "misc_util.h" #include "Virt_VSSD.h" +#include "Virt_RASD.h" const static CMPIBroker *_BROKER; -static CMPIStatus vssd_to_sd(const CMPIObjectPath *ref, - struct std_assoc_info *info, - struct inst_list *list) +static CMPIStatus vssd_to_vssd(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) { CMPIStatus s; CMPIInstance *inst; @@ -83,6 +84,49 @@ static CMPIStatus vssd_to_sd(const CMPIO return s; } +static CMPIStatus rasd_to_rasd(const CMPIObjectPath *ref, + struct std_assoc_info *info, + struct inst_list *list) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + CMPIInstance *inst; + char *id = NULL; + uint16_t type; + + ASSOC_MATCH(info->provider_name, CLASSNAME(ref)); + + id = cu_get_str_path(ref, "InstanceID"); + if (id == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Missing InstanceID"); + goto out; + } + + if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unable to determine RASD type"); + goto out; + } + + inst = get_rasd_instance(info->context, ref, _BROKER, id, type); + if (inst == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Error getting associated RASD"); + + goto out; + } + + inst_list_add(list, inst); + + out: + free(id); + + return s; +} + static CMPIInstance *make_ref(const CMPIObjectPath *ref, const CMPIInstance *inst, struct std_assoc_info *info, @@ -130,7 +174,7 @@ out: return refinst; } -static struct std_assoc vssd_to_sd_fd_bkwd = { +static struct std_assoc _vssd_to_vssd = { .source_class = "CIM_VirtualSystemSettingData", .source_prop = "ManagedElement", @@ -139,12 +183,26 @@ static struct std_assoc vssd_to_sd_fd_bk .assoc_class = "CIM_ElementSettingData", - .handler = vssd_to_sd, + .handler = vssd_to_vssd, .make_ref = make_ref }; +static struct std_assoc _rasd_to_rasd = { + .source_class = "CIM_ResourceAllocationSettingData", + .source_prop = "ManagedElement", + + .target_class = "CIM_ManagedElement", + .target_prop = "SettingData", + + .assoc_class = "CIM_ElementSettingData", + + .handler = rasd_to_rasd, + .make_ref = make_ref +}; + static struct std_assoc *handlers[] = { - &vssd_to_sd_fd_bkwd, + &_vssd_to_vssd, + &_rasd_to_rasd, NULL };