add two association class accroding to DSP1050, Net_ElementSettingData and
Net_EthernetPortConnectionSettingData.
Signed-off-by: Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
---
schema/ElementSettingData.mof | 16 ++-
schema/ElementSettingData.registration | 4 +-
src/Virt_ElementSettingData.c | 229 +++++++++++++++++++++++++++++++-
3 files changed, 246 insertions(+), 3 deletions(-)
diff --git a/schema/ElementSettingData.mof b/schema/ElementSettingData.mof
index 2bfc52a..9ba116f 100644
--- a/schema/ElementSettingData.mof
+++ b/schema/ElementSettingData.mof
@@ -1,4 +1,4 @@
-// Copyright IBM Corp. 2007
+// Copyright IBM Corp. 2011
[Association,
Provider("cmpi::Virt_ElementSettingData")
@@ -20,3 +20,17 @@ class KVM_ElementSettingData : CIM_ElementSettingData
class LXC_ElementSettingData : CIM_ElementSettingData
{
};
+
+[Association,
+ Provider("cmpi::Virt_ElementSettingData")
+]
+class Net_ElementSettingData : CIM_ElementSettingData
+{
+};
+
+[Association,
+ Provider("cmpi::Virt_ElementSettingData")
+]
+class Net_EthernetPortConnectionSettingData : CIM_ElementSettingData
+{
+};
diff --git a/schema/ElementSettingData.registration
b/schema/ElementSettingData.registration
index edec78c..8cff13b 100644
--- a/schema/ElementSettingData.registration
+++ b/schema/ElementSettingData.registration
@@ -1,5 +1,7 @@
-# Copyright IBM Corp. 2007
+# Copyright IBM Corp. 2011
# Classname Namespace ProviderName ProviderModule ProviderTypes
Xen_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData
association
KVM_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData
association
LXC_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData
association
+Net_ElementSettingData root/virt Virt_ElementSettingData Virt_ElementSettingData
association
+Net_EthernetPortConnectionSettingData root/virt Virt_ElementSettingData
Virt_ElementSettingData association
diff --git a/src/Virt_ElementSettingData.c b/src/Virt_ElementSettingData.c
index b5b7b02..269b3d2 100644
--- a/src/Virt_ElementSettingData.c
+++ b/src/Virt_ElementSettingData.c
@@ -1,9 +1,12 @@
/*
- * Copyright IBM Corp. 2007
+ * Copyright IBM Corp. 2011
*
* Authors:
* Kaitlin Rupert <karupert(a)us.ibm.com>
*
+ * Modified by:
+ * Wenchao Xia <xiawenc(a)cn.ibm.com>
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -32,6 +35,10 @@
#include "Virt_VSSD.h"
#include "Virt_RASD.h"
+#include "Virt_VESSSD.h"
+#include "Virt_EASD.h"
+#include "Virt_EthernetPort.h"
+#include "network_model.h"
const static CMPIBroker *_BROKER;
@@ -81,6 +88,145 @@ static CMPIStatus rasd_to_rasd(const CMPIObjectPath *ref,
return s;
}
+static CMPIStatus vesssd_to_vesssd(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst;
+
+ if (!match_hypervisor_prefix(ref, info)) {
+ return s;
+ }
+
+ /* Special association case:
+ * VESSSD instance is pointing to itself
+ */
+ s = get_vesssd_by_ref(_BROKER, ref, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ inst_list_add(list, inst);
+
+ out:
+ return s;
+}
+
+static CMPIStatus easd_to_easd(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+
+ if (!match_hypervisor_prefix(ref, info)) {
+ return s;
+ }
+
+ /* Special association case:
+ * EASD instance is pointing to itself
+ */
+ s = get_easd_by_ref(_BROKER, ref, info->properties, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ inst_list_add(list, inst);
+
+ out:
+ return s;
+}
+
+/* according to DSP 1050.1.0.0_0 page 41, ESD only associate EP with EASD_EC */
+static CMPIStatus easd_to_ep(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ const char *name = NULL;
+ char *newid = NULL;
+
+ if (!match_hypervisor_prefix(ref, info)) {
+ return s;
+ }
+
+ /* the step of creating a easd instance is skipped to make it fast */
+
+ if (cu_get_str_path(ref, "InstanceID", &name) != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Missing InstanceID");
+ goto out;
+ }
+ newid = easdec_id_to_ep_id(name);
+
+ if (newid == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Invalid InstanceID set.");
+ goto out;
+ }
+
+ s = get_ep_by_id(_BROKER, newid, ref, NULL, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ inst_list_add(list, inst);
+
+
+ out:
+ free(newid);
+ return s;
+}
+
+static CMPIStatus ep_to_easd(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *newid = NULL;
+ const char *name;
+
+ if (!match_hypervisor_prefix(ref, info)) {
+ return s;
+ }
+
+ /* the step of creating a ep instance is skipped to make it fast */
+ if (cu_get_str_path(ref, "DeviceID", &name) != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "No DeviceID specified");
+ goto out;
+ }
+
+ newid = ep_id_to_easdec_id(name);
+ if (newid == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Invalid DeviceID set.");
+ goto out;
+ }
+
+ s = get_easd_by_id(_BROKER,
+ newid,
+ ref,
+ NULL,
+ &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ inst_list_add(list, inst);
+
+ out:
+ free(newid);
+ return s;
+}
+
static CMPIInstance *make_ref(const CMPIObjectPath *source_ref,
const CMPIInstance *target_inst,
struct std_assoc_info *info,
@@ -151,6 +297,31 @@ static char* assoc_classname[] = {
NULL
};
+static char *vesssd[] = {
+ "Net_VirtualEthernetSwitchSystemSettingData",
+ NULL
+};
+
+static char *easd[] = {
+ "Net_EthernetPortAllocationSettingData",
+ NULL
+};
+
+static char *ep[] = {
+ "Net_EthernetPort",
+ NULL
+};
+
+static char *assoc_vess[] = {
+ "Net_ElementSettingData",
+ NULL
+};
+
+static char *assoc_conn[] = {
+ "Net_EthernetPortConnectionSettingData",
+ NULL
+};
+
static struct std_assoc _vssd_to_vssd = {
.source_class = (char**)&virtual_system_setting_data,
.source_prop = "ManagedElement",
@@ -177,9 +348,65 @@ static struct std_assoc _rasd_to_rasd = {
.make_ref = make_ref
};
+static struct std_assoc _vesssd_to_vesssd = {
+ .source_class = (char **)&vesssd,
+ .source_prop = "ManagedElement",
+
+ .target_class = (char **)&vesssd,
+ .target_prop = "SettingData",
+
+ .assoc_class = (char **)&assoc_vess,
+
+ .handler = vesssd_to_vesssd,
+ .make_ref = make_ref
+};
+
+static struct std_assoc _easd_to_easd = {
+ .source_class = (char **)&easd,
+ .source_prop = "ManagedElement",
+
+ .target_class = (char **)&easd,
+ .target_prop = "SettingData",
+
+ .assoc_class = (char **)&assoc_vess,
+
+ .handler = easd_to_easd,
+ .make_ref = make_ref
+};
+
+static struct std_assoc _easd_to_ep = {
+ .source_class = (char **)&easd,
+ .source_prop = "ManagedElement",
+
+ .target_class = (char **)&ep,
+ .target_prop = "SettingData",
+
+ .assoc_class = (char **)&assoc_conn,
+
+ .handler = easd_to_ep,
+ .make_ref = make_ref
+};
+
+static struct std_assoc _ep_to_easd = {
+ .source_class = (char **)&ep,
+ .source_prop = "ManagedElement",
+
+ .target_class = (char **)&easd,
+ .target_prop = "SettingData",
+
+ .assoc_class = (char **)&assoc_conn,
+
+ .handler = ep_to_easd,
+ .make_ref = make_ref
+};
+
static struct std_assoc *handlers[] = {
&_vssd_to_vssd,
&_rasd_to_rasd,
+ &_vesssd_to_vesssd,
+ &_easd_to_easd,
+ &_easd_to_ep,
+ &_ep_to_easd,
NULL
};
--
1.7.6