# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1195605557 28800
# Node ID 83aeadb6ebd9089e633013a0c65246a6d4881fcb
# 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(a)us.ibm.com>
diff -r 278c59f67cb1 -r 83aeadb6ebd9 src/Makefile.am
--- a/src/Makefile.am Tue Nov 20 16:26:00 2007 -0500
+++ b/src/Makefile.am Tue Nov 20 16:39:17 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 83aeadb6ebd9 src/Virt_ElementSettingData.c
--- a/src/Virt_ElementSettingData.c Tue Nov 20 16:26:00 2007 -0500
+++ b/src/Virt_ElementSettingData.c Tue Nov 20 16:39:17 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,41 @@ 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;
+
+ 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;
+ }
+
+ inst = get_rasd_instance_from_ref(info->context, ref, id, _BROKER);
+ 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 +166,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 +175,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
};