[Libvirt-cim] [PATCH 2 of 2] Adding the RASD related part

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Nov 20 06:43:21 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1195544365 28800
# Node ID a71690c7cf6caae2a3f55461980159b8d8fb92e3
# Parent  8cbe28df0e8e53c34c38620ce169dcea4091e72e
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.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 8cbe28df0e8e -r a71690c7cf6c src/Makefile.am
--- a/src/Makefile.am	Mon Nov 19 16:19:06 2007 -0500
+++ b/src/Makefile.am	Mon Nov 19 23:39:25 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 8cbe28df0e8e -r a71690c7cf6c src/Virt_ElementSettingData.c
--- a/src/Virt_ElementSettingData.c	Mon Nov 19 16:19:06 2007 -0500
+++ b/src/Virt_ElementSettingData.c	Mon Nov 19 23:39:25 2007 -0800
@@ -31,6 +31,7 @@
 #include "misc_util.h"
 
 #include "Virt_VSSD.h"
+#include "Virt_RASD.h"
 
 const static CMPIBroker *_BROKER;
 
@@ -83,6 +84,28 @@ static CMPIStatus vssd_to_sd(const CMPIO
         return s;
 }
 
+static CMPIStatus rasd_to_sd(const CMPIObjectPath *ref,
+                             struct std_assoc_info *info,
+                             struct inst_list *list)
+{
+        CMPIStatus s = {CMPI_RC_OK, NULL};
+        CMPIInstance *inst;
+
+        ASSOC_MATCH(info->provider_name, CLASSNAME(ref));
+
+        inst = get_rasd_instance_from_ref(info->context, ref, _BROKER);
+        if (inst == NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_FAILED,
+                           "Error getting associated RASD");
+        }
+
+        else
+                inst_list_add(list, inst);
+
+        return s;
+}
+
 static CMPIInstance *make_ref(const CMPIObjectPath *ref,
                               const CMPIInstance *inst,
                               struct std_assoc_info *info,
@@ -129,7 +152,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",
 
@@ -142,8 +165,22 @@ static struct std_assoc vssd_to_sd_fd_bk
         .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_sd,
+        .make_ref = make_ref
+};
+
 static struct std_assoc *handlers[] = {
-        &vssd_to_sd_fd_bkwd,
+        &vssd_to_vssd,
+        &rasd_to_rasd,
         NULL
 };
 




More information about the Libvirt-cim mailing list