[PATCH 04/15] vlan extension - CIM model - add class EthernetPort
by Wayne Xia
adding the Net_EthernetPort class.
Signed-off-by: Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
---
schema/EthernetPort.mof | 4 +
schema/EthernetPort.registration | 3 +
src/Virt_EthernetPort.c | 565 ++++++++++++++++++++++++++++++++++++++
src/Virt_EthernetPort.h | 58 ++++
4 files changed, 630 insertions(+), 0 deletions(-)
create mode 100644 schema/EthernetPort.mof
create mode 100644 schema/EthernetPort.registration
create mode 100644 src/Virt_EthernetPort.c
create mode 100644 src/Virt_EthernetPort.h
diff --git a/schema/EthernetPort.mof b/schema/EthernetPort.mof
new file mode 100644
index 0000000..4a81c91
--- /dev/null
+++ b/schema/EthernetPort.mof
@@ -0,0 +1,4 @@
+// Copyright IBM Corp. 2011
+class Net_EthernetPort : CIM_EthernetPort
+{
+};
diff --git a/schema/EthernetPort.registration b/schema/EthernetPort.registration
new file mode 100644
index 0000000..67320d0
--- /dev/null
+++ b/schema/EthernetPort.registration
@@ -0,0 +1,3 @@
+# Copyright IBM Corp. 2011
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Net_EthernetPort root/virt Virt_EthernetPort Virt_EthernetPort instance
diff --git a/src/Virt_EthernetPort.c b/src/Virt_EthernetPort.c
new file mode 100644
index 0000000..751fb33
--- /dev/null
+++ b/src/Virt_EthernetPort.c
@@ -0,0 +1,565 @@
+/*
+ * Copyright IBM Corp. 2007
+ *
+ * Authors:
+ * 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
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+#include <sys/stat.h>
+
+#include <cmpidt.h>
+#include <cmpift.h>
+#include <cmpimacs.h>
+
+#include <libcmpiutil/libcmpiutil.h>
+#include <libcmpiutil/std_instance.h>
+
+#include "misc_util.h"
+#include "cs_util.h"
+#include "infostore.h"
+
+#include "Virt_EthernetPort.h"
+#include "svpc_types.h"
+#include "Virt_Device.h"
+#include "Virt_VirtualEthernetSwitchSystem.h"
+#include "Virt_EASD.h"
+#include "network_model.h"
+
+static const CMPIBroker *_BROKER;
+
+static int set_primary_for_ep(const CMPIBroker *broker, const char* prefix,
+ EthIface *piface, CMPIInstance *instance)
+{
+ char *eth_name, *ep_name;
+ const char *syscls_name = "Virt_VirtualEthernetSwitchSystem";
+ int asret;
+
+ if (piface->name == NULL) {
+ return 0;
+ }
+
+ eth_name = get_ethport_name_from_iface(piface->name);
+ asret = asprintf(&ep_name, "%s/%s", prefix, eth_name);
+
+ CMSetProperty(instance, "DeviceID",
+ (CMPIValue *)ep_name, CMPI_chars);
+
+ CMSetProperty(instance, "InstanceID",
+ (CMPIValue *)ep_name, CMPI_chars);
+
+ CMSetProperty(instance, "ElementName",
+ (CMPIValue *)eth_name, CMPI_chars);
+ SAFE_FREE(ep_name);
+ SAFE_FREE(eth_name);
+
+ CMSetProperty(instance, "SystemCreationClassName",
+ (CMPIValue *)syscls_name, CMPI_chars);
+
+ CMSetProperty(instance, "SystemName",
+ (CMPIValue *)prefix, CMPI_chars);
+
+ return 1;
+}
+
+static int set_secondary_for_ep(const CMPIBroker *broker, EthIface *piface,
+ CMPIInstance *instance)
+{
+ int state;
+ uint16_t cim_type;
+ CMPIArray *array;
+ CMPIStatus s;
+ CMPIString *str;
+
+ if (piface->run_prop.state == ETH_STATE_DOWN) {
+ state = CIM_STATE_DISABLED;
+ } else if (piface->run_prop.state == ETH_STATE_UP) {
+ state = CIM_STATE_ENABLED;
+ } else {
+ state = CIM_STATE_UNKNOWN;
+ }
+ CMSetProperty(instance, "EnabledState",
+ (CMPIValue *)&state, CMPI_uint16);
+ CMSetProperty(instance, "RequestedState",
+ (CMPIValue *)&state, CMPI_uint16);
+
+ cim_type = CIM_NUM_NET_ETHERNET;
+ CMSetProperty(instance, "LinkTechnology",
+ (CMPIValue *)&cim_type, CMPI_uint16);
+
+ if (piface->mac != NULL) {
+ array = CMNewArray(broker, 1, CMPI_string, &s);
+ if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(array))) {
+ CU_DEBUG("failed to create array.");
+ return 0;
+ }
+ str = CMNewString(broker, piface->mac, &s);
+ if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(str))) {
+ CU_DEBUG("failed to create array.");
+ return 0;
+ }
+
+ CMSetArrayElementAt(array, 0, &str, CMPI_string);
+
+ CMSetProperty(instance, "NetworkAddresses",
+ (CMPIValue *)&array, CMPI_stringA);
+ }
+
+ return 1;
+}
+
+static CMPIStatus set_properties(const CMPIBroker *broker,
+ EthIface *piface,
+ const char *prefix,
+ CMPIInstance *instance)
+{
+ CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL};
+ char *errstr;
+
+ if (!set_primary_for_ep(broker, prefix, piface, instance)) {
+ errstr = "failed to set primary properties for instance.";
+ CU_DEBUG("%s, iface name %s.", errstr, piface->name);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ if (!set_secondary_for_ep(broker, piface, instance)) {
+ errstr = "failed to set secondary properties for instance.";
+ CU_DEBUG("%s, iface name %s.", errstr, piface->name);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ cu_statusf(broker, &s,
+ CMPI_RC_OK,
+ "");
+
+ out:
+ return s;
+}
+
+
+static CMPIStatus instance_from_ep_build(const CMPIBroker *broker,
+ EthIface *piface,
+ const char *prefix,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst)
+{
+ CMPIInstance *inst = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ const char *keys[] = {"InstanceID", NULL};
+
+ inst = get_typed_instance(broker,
+ NETWORK_CLASS_PREFIX,
+ "EthernetPort",
+ NAMESPACE(reference));
+ if (inst == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to init ep instance");
+ goto out;
+ }
+
+ s = CMSetPropertyFilter(inst, properties, keys);
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("Unable to set property filter: %d", s.rc);
+ }
+
+ s = set_properties(broker,
+ piface,
+ prefix,
+ inst);
+
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ *_inst = inst;
+
+ out:
+ return s;
+}
+
+
+static CMPIStatus instance_from_ep(const CMPIBroker *broker,
+ EthIface *piface,
+ const char *vsname,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ struct inst_list *plist)
+{
+
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *br1_name = NULL, *br2_name = NULL;
+
+ get_possible_bridge_name_for_cim_model(piface, &br1_name, &br2_name);
+ if (br1_name == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "failed to find any bridge for the port.");
+ CU_DEBUG("failed to find any bridge for the port %s.",
+ piface->name);
+ goto out;
+ }
+
+ /* building up the instance */
+ if ((vsname == NULL) || (0 == strcmp(vsname, br1_name))) {
+ inst = NULL;
+ s = instance_from_ep_build(broker,
+ piface,
+ br1_name,
+ reference,
+ properties,
+ &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+ inst_list_add(plist, inst);
+ }
+
+ /* following is to make it comform to CIM profile which require two
+ ethports connectted to pNIC and vswitch, but we have only one piface
+ on linux indicating it is connected to pNIC and bridge at sametime */
+ if (br2_name == NULL) {
+ goto out;
+ }
+
+ if ((vsname == NULL) || (0 == strcmp(vsname, br2_name))) {
+ inst = NULL;
+ s = instance_from_ep_build(broker,
+ piface,
+ br2_name,
+ reference,
+ properties,
+ &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+ inst_list_add(plist, inst);
+ }
+
+
+ out:
+ SAFE_FREE(br1_name);
+ SAFE_FREE(br2_name);
+ return s;
+}
+
+CMPIStatus get_ep_by_name(const CMPIBroker *broker,
+ const char *prefix,
+ const char *name,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *eth_name = NULL;
+ char *dest = NULL;
+ char *errstr;
+ int ret;
+ EthIfacesList ifaces_list;
+ struct inst_list list;
+
+ eth_ifaceslist_init(&ifaces_list);
+ inst_list_init(&list);
+
+ eth_name = get_iface_name_from_ethport(name);
+ if (eth_name == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "failed to convert instance name");
+ CU_DEBUG("ethport name %s failed to convert.", name);
+ goto out;
+ }
+
+ ret = get_host_ifaces(&ifaces_list,
+ eth_iface_filter_cim_ethport_for_name, eth_name);
+
+ if (ret != 1) {
+ errstr = get_host_iface_error_reason(ret);
+ CU_DEBUG("error num %d returned, reason %s.", ret, errstr);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+ if (ifaces_list.count != 1) {
+ errstr = "expected ethport not found.";
+ CU_DEBUG("%s\n", errstr);
+ eth_ifaceslist_print(&ifaces_list);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ inst = NULL;
+ s = instance_from_ep(broker,
+ ifaces_list.pifaces[0],
+ prefix,
+ reference,
+ properties,
+ &list);
+
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ if (list.cur == 0) {
+ CU_DEBUG("%d instance found, expect is 1.", list.cur);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "no such instance.");
+ goto out;
+ }
+
+ if (list.cur > 1) {
+ CU_DEBUG("%d instance found, expect is 1.", list.cur);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "instance found do not match expectation");
+ goto out;
+ }
+
+ *_inst = list.list[0];
+ list.list[0] = NULL;
+
+ out:
+ eth_ifaceslist_uninit(&ifaces_list);
+ inst_list_free(&list);
+ SAFE_FREE(eth_name);
+ SAFE_FREE(dest);
+ return s;
+}
+
+CMPIStatus get_ep_by_id(const CMPIBroker *broker,
+ const char *id,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ char *prefix = NULL;
+ char *suffix = NULL;
+ if (id == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "ID is NULL'", id);
+ }
+ if (!parse_fq_devid(id, &prefix, &suffix) || (prefix == NULL) ||
+ (suffix == NULL)) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Invalid InstanceID `%s'", id);
+ goto out;
+ }
+ s = get_ep_by_name(broker, prefix, suffix, reference,
+ properties, _inst);
+
+ out:
+ SAFE_FREE(prefix);
+ SAFE_FREE(suffix);
+ return s;
+}
+
+CMPIStatus get_ep_by_ref(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *name = NULL;
+ char *prefix = NULL;
+ const char *id;
+
+ if (cu_get_str_path(reference, "DeviceID", &id) != CMPI_RC_OK) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance (InstanceID)");
+ goto out;
+ }
+ if ((!parse_fq_devid(id, &prefix, &name)) ||
+ (name == NULL) || (prefix == NULL)) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Failed to translate (InstanceID)");
+ goto out;
+ }
+
+ s = get_ep_by_name(broker, prefix, name, reference,
+ properties, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ s = cu_validate_ref(broker, reference, inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ *_inst = inst;
+
+ out:
+ free(name);
+ free(prefix);
+
+ return s;
+}
+
+
+CMPIStatus enum_eps(const CMPIBroker *broker,
+ const char *ref_vsname,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ struct inst_list *plist)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ EthIfacesList ifaces_list;
+ int ret, i;
+ char *errstr;
+
+ eth_ifaceslist_init(&ifaces_list);
+
+ ret = get_host_ifaces(&ifaces_list,
+ eth_iface_filter_cim_ethport, NULL);
+ if (ret != 1) {
+ errstr = get_host_iface_error_reason(ret);
+ CU_DEBUG("error num %d returned, reason %s.", ret, errstr);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+ CU_DEBUG("enum ep, found following devices.")
+ eth_ifaceslist_print(&ifaces_list);
+
+ i = 0;
+ while (i < ifaces_list.count) {
+ s = instance_from_ep(broker,
+ ifaces_list.pifaces[i],
+ ref_vsname,
+ reference,
+ properties,
+ plist);
+ i++;
+ /* this should never fail */
+ if (s.rc != CMPI_RC_OK) {
+ CU_DEBUG("unexpected fail.");
+ break;
+ }
+ }
+
+
+ out:
+ eth_ifaceslist_uninit(&ifaces_list);
+
+ return s;
+}
+
+static CMPIStatus return_enum_eps(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ const CMPIResult *results,
+ const char **properties,
+ const bool names_only)
+{
+ struct inst_list list;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ inst_list_init(&list);
+ s = enum_eps(broker, NULL, reference, properties, &list);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ if (names_only) {
+ cu_return_instance_names(results, &list);
+ } else {
+ cu_return_instances(results, &list);
+ }
+
+ out:
+ inst_list_free(&list);
+ return s;
+}
+
+static CMPIStatus EnumInstanceNames(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *reference)
+{
+ return return_enum_eps(_BROKER, reference, results, NULL, true);
+}
+
+static CMPIStatus EnumInstances(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *reference,
+ const char **properties)
+{
+
+ return return_enum_eps(_BROKER, reference, results, properties, false);
+}
+
+static CMPIStatus GetInstance(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *ref,
+ const char **properties)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+
+ s = get_ep_by_ref(_BROKER, ref, properties, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ CMReturnInstance(results, inst);
+
+ out:
+ return s;
+}
+
+DEFAULT_CI();
+DEFAULT_MI();
+DEFAULT_DI();
+DEFAULT_INST_CLEANUP();
+DEFAULT_EQ();
+
+STD_InstanceMIStub(,
+ Virt_EthernetPort,
+ _BROKER,
+ libvirt_cim_init());
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-set-style: "K&R"
+ * tab-width: 8
+ * c-basic-offset: 8
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/src/Virt_EthernetPort.h b/src/Virt_EthernetPort.h
new file mode 100644
index 0000000..f474af2
--- /dev/null
+++ b/src/Virt_EthernetPort.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright IBM Corp. 2011
+ *
+ * Authors:
+ * Wencao 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
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __VIRT_ETHERNETPORT_H
+#define __VIRT_ETHERNETPORT_H
+
+CMPIStatus enum_eps(const CMPIBroker *broker,
+ const char *ref_vsname,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ struct inst_list *plist);
+
+CMPIStatus get_ep_by_name(const CMPIBroker *broker,
+ const char *prefix,
+ const char *name,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst);
+
+CMPIStatus get_ep_by_id(const CMPIBroker *broker,
+ const char *id,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst);
+
+CMPIStatus get_ep_by_ref(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ const char **properties,
+ CMPIInstance **_inst);
+
+#endif
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-set-style: "K&R"
+ * tab-width: 8
+ * c-basic-offset: 8
+ * indent-tabs-mode: nil
+ * End:
+ */
--
1.7.6
13 years
[PATCH 03/15] vlan extension - CIM model - add class VESSSD
by Wayne Xia
This patch added class the Net_VirtualEthernetSwitchSystemSettingData.
Signed-off-by: Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
---
schema/VirtualEthernetSwitchSystemSettingData.mof | 27 ++
...ualEthernetSwitchSystemSettingData.registration | 3 +
src/Virt_VESSSD.c | 372 ++++++++++++++++++++
src/Virt_VESSSD.h | 39 ++
4 files changed, 441 insertions(+), 0 deletions(-)
create mode 100644 schema/VirtualEthernetSwitchSystemSettingData.mof
create mode 100644 schema/VirtualEthernetSwitchSystemSettingData.registration
create mode 100644 src/Virt_VESSSD.c
create mode 100644 src/Virt_VESSSD.h
diff --git a/schema/VirtualEthernetSwitchSystemSettingData.mof b/schema/VirtualEthernetSwitchSystemSettingData.mof
new file mode 100644
index 0000000..81ef22a
--- /dev/null
+++ b/schema/VirtualEthernetSwitchSystemSettingData.mof
@@ -0,0 +1,27 @@
+// Copyright IBM Corp. 2007
+
+
+/* fix me: the libvirt-cim lacks parent class
+ "VirtualEthernetSwitchSettingData" defined in DSP1050 */
+[Description (
+ "A class derived from Virt_VirtualEthernetSystemSettingData to represent "
+ "the config of ."),
+ Provider("cmpi::Virt_VESSSD")
+]
+class Net_VirtualEthernetSwitchSystemSettingData : CIM_VirtualSystemSettingData
+{
+
+ [Description ("Virtual Switch System type number")]
+ string VirtualSystemType;
+
+ string AssociatedResourcePool;
+
+ uint16 VLAN_Connection[];
+
+ uint16 MaxNumAddress;
+
+ uint16 EVBMode;
+
+ uint16 STP;
+
+};
diff --git a/schema/VirtualEthernetSwitchSystemSettingData.registration b/schema/VirtualEthernetSwitchSystemSettingData.registration
new file mode 100644
index 0000000..14bfc30
--- /dev/null
+++ b/schema/VirtualEthernetSwitchSystemSettingData.registration
@@ -0,0 +1,3 @@
+# Copyright IBM Corp. 2011
+# Classname Namespace ProviderName ProviderModule ProviderTypes
+Net_VirtualEthernetSwitchSystemSettingData root/virt Virt_VESSSD Virt_VESSSD instance
diff --git a/src/Virt_VESSSD.c b/src/Virt_VESSSD.c
new file mode 100644
index 0000000..71627da
--- /dev/null
+++ b/src/Virt_VESSSD.c
@@ -0,0 +1,372 @@
+/*
+ * Copyright IBM Corp. 2011
+ *
+ * Authors:
+ * 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
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <cmpidt.h>
+#include <cmpift.h>
+#include <cmpimacs.h>
+
+#include <libcmpiutil/libcmpiutil.h>
+#include <libcmpiutil/std_instance.h>
+
+#include "cs_util.h"
+#include "misc_util.h"
+#include "device_parsing.h"
+
+#include "Virt_VirtualEthernetSwitchSystem.h"
+#include "Virt_VESSSD.h"
+#include "network_model.h"
+
+static const CMPIBroker *_BROKER;
+
+static int set_primary_for_vesssd(const char *prefix, const CMPIBroker *broker,
+ EthIface *piface, CMPIInstance *instance)
+{
+ char *name, *vesssd_name;
+ int asret;
+
+ if (piface->name == NULL) {
+ return 0;
+ }
+
+ CMSetProperty(instance, "VirtualSystemType",
+ (CMPIValue *)"DMTF:VirtualEthernetSwitch", CMPI_chars);
+
+ name = get_switch_name_from_iface(piface->name);
+ asret = asprintf(&vesssd_name, "%s:%s", prefix, name);
+
+ CMSetProperty(instance, "InstanceID",
+ (CMPIValue *)vesssd_name, CMPI_chars);
+ CMSetProperty(instance, "ElementName",
+ (CMPIValue *)name, CMPI_chars);
+ CMSetProperty(instance, "VirtualSystemIdentifier",
+ (CMPIValue *)name, CMPI_chars);
+ CMSetProperty(instance, "VirtualSystemType",
+ (CMPIValue *)prefix, CMPI_chars);
+
+
+
+ free(vesssd_name);
+ SAFE_FREE(name);
+
+ return 1;
+}
+
+static int set_secondary_for_vesssd(const CMPIBroker *broker, EthIface *piface,
+ CMPIInstance *instance)
+{
+ if (piface->eth_type == ETH_TYPE_BRIDGE) {
+ CMSetProperty(instance, "STP",
+ (CMPIValue *)&piface->pbr_prop->STP, CMPI_uint16);
+ }
+
+ /* TODO add VLAN id discovery */
+ return 1;
+}
+
+/* Populate an instance with information from a switch */
+static CMPIStatus set_properties(const CMPIBroker *broker,
+ EthIface *piface,
+ const char *prefix,
+ CMPIInstance *instance)
+{
+ CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL};
+ char *errstr;
+
+ if (!set_primary_for_vesssd(prefix, broker, piface, instance)) {
+ errstr = "failed to set primary properties for instance.";
+ CU_DEBUG("%s, iface name %s.", errstr, piface->name);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+ if (!set_secondary_for_vesssd(broker, piface, instance)) {
+ errstr = "failed to set secondary properties for instance.";
+ CU_DEBUG("%s, iface name %s.", errstr, piface->name);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ cu_statusf(broker, &s,
+ CMPI_RC_OK,
+ "");
+
+ out:
+ return s;
+}
+
+static CMPIStatus instance_from_vesssd(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ EthIface *piface,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+
+ inst = get_typed_instance(broker,
+ NETWORK_CLASS_PREFIX,
+ "VirtualEthernetSwitchSystemSettingData",
+ NAMESPACE(reference));
+ if (inst == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to init SwitchSystem instance");
+ goto out;
+ }
+
+ s = set_properties(broker,
+ piface,
+ VESSD_SYSTEM_PREFIX,
+ inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ *_inst = inst;
+
+ out:
+ return s;
+}
+
+CMPIStatus enum_vesssd(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ struct inst_list *plist)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ EthIfacesList ifaces_list;
+ int ret, i;
+ char *errstr;
+
+ eth_ifaceslist_init(&ifaces_list);
+
+ ret = get_host_ifaces(&ifaces_list,
+ eth_iface_filter_cim_switch, NULL);
+
+ if (ret != 1) {
+ errstr = get_host_iface_error_reason(ret);
+ CU_DEBUG("error num %d returned, reason %s.", ret, errstr);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ i = 0;
+ while (i < ifaces_list.count) {
+ CMPIInstance *inst = NULL;
+
+ s = instance_from_vesssd(broker,
+ reference,
+ ifaces_list.pifaces[i],
+ &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ inst_list_add(plist, inst);
+ i++;
+ }
+
+ out:
+ eth_ifaceslist_uninit(&ifaces_list);
+
+ return s;
+}
+
+static CMPIStatus return_enum_vesssd(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ const CMPIResult *results,
+ bool names_only)
+{
+ struct inst_list list;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ inst_list_init(&list);
+
+ s = enum_vesssd(broker, reference, &list);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ if (names_only) {
+ cu_return_instance_names(results, &list);
+ } else {
+ cu_return_instances(results, &list);
+ }
+ out:
+ inst_list_free(&list);
+ return s;
+}
+
+CMPIStatus get_vesssd_by_name(const CMPIBroker *broker,
+ const char *name,
+ const CMPIObjectPath *reference,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *eth_name = NULL;
+ char *errstr;
+ int ret;
+ EthIfacesList ifaces_list;
+
+ eth_ifaceslist_init(&ifaces_list);
+
+ eth_name = get_iface_name_from_switch(name);
+ if (eth_name == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "failed to convert switch_name");
+ CU_DEBUG("switch name %s failed to convert.", name);
+ goto out;
+ }
+
+ ret = get_host_ifaces(&ifaces_list,
+ eth_iface_filter_cim_switch_for_name, eth_name);
+
+ if (ret != 1) {
+ errstr = get_host_iface_error_reason(ret);
+ CU_DEBUG("error num %d returned, reason %s.", ret, errstr);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+ if (ifaces_list.count != 1) {
+ errstr = "expected switch not found.";
+ CU_DEBUG("%s\n", errstr);
+ eth_ifaceslist_print(&ifaces_list);
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ errstr);
+ goto out;
+ }
+
+ s = instance_from_vesssd(broker,
+ reference,
+ ifaces_list.pifaces[0],
+ &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ *_inst = inst;
+
+ out:
+ eth_ifaceslist_uninit(&ifaces_list);
+ SAFE_FREE(eth_name);
+ return s;
+}
+
+CMPIStatus get_vesssd_by_ref(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ CMPIInstance **_inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char *name = NULL;
+
+ if ((!parse_instanceid(reference, NULL, &name)) || (name == NULL)) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance (InstanceID)");
+ goto out;
+ }
+
+ s = get_vesssd_by_name(broker, name, reference, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ s = cu_validate_ref(broker, reference, inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ *_inst = inst;
+
+ out:
+ free(name);
+
+ return s;
+}
+
+static CMPIStatus EnumInstanceNames(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *reference)
+{
+ return return_enum_vesssd(_BROKER, reference, results, true);
+}
+
+static CMPIStatus EnumInstances(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *reference,
+ const char **properties)
+{
+ return return_enum_vesssd(_BROKER, reference, results, false);
+}
+
+static CMPIStatus GetInstance(CMPIInstanceMI *self,
+ const CMPIContext *context,
+ const CMPIResult *results,
+ const CMPIObjectPath *reference,
+ const char **properties)
+{
+ CMPIStatus s;
+ CMPIInstance *inst = NULL;
+
+ s = get_vesssd_by_ref(_BROKER, reference, &inst);
+ if (s.rc != CMPI_RC_OK) {
+ goto out;
+ }
+
+ CMReturnInstance(results, inst);
+
+ out:
+ return s;
+}
+
+DEFAULT_CI();
+DEFAULT_MI();
+DEFAULT_DI();
+DEFAULT_EQ();
+DEFAULT_INST_CLEANUP();
+
+STD_InstanceMIStub(,
+ Virt_VESSSD,
+ _BROKER,
+ libvirt_cim_init());
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-set-style: "K&R"
+ * tab-width: 8
+ * c-basic-offset: 8
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/src/Virt_VESSSD.h b/src/Virt_VESSSD.h
new file mode 100644
index 0000000..5105057
--- /dev/null
+++ b/src/Virt_VESSSD.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright IBM Corp. 2011
+ *
+ * Authors:
+ * 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
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __VIRT_VESSSD_H
+#define __VIRT_VESSSD_H
+
+
+CMPIStatus enum_vesssd(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ struct inst_list *plist);
+
+CMPIStatus get_vesssd_by_ref(const CMPIBroker *broker,
+ const CMPIObjectPath *reference,
+ CMPIInstance **_inst);
+
+CMPIStatus get_vesssd_by_name(const CMPIBroker *broker,
+ const char *name,
+ const CMPIObjectPath *reference,
+ CMPIInstance **_inst);
+
+
+#endif
--
1.7.6
13 years
[PATCH] cpu cgroup patch 2
by Gareth S. Bestor
Signed-off-by: Gareth S. Bestor <bestor(a)us.ibm.com>
---
libxkutil/xmlgen.c | 45 +++++++++++++++++++++++++++++
src/Virt_ComputerSystem.c | 6 ++++
src/Virt_RASD.c | 6 +++-
src/Virt_VirtualSystemManagementService.c | 30 +++++++++++++++++++
4 files changed, 86 insertions(+), 1 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 4cca75b..2fe41bf 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -365,6 +365,44 @@ static const char *vcpu_xml(xmlNodePtr root, struct domain *dominfo)
return NULL;
}
+#if LIBVIR_VERSION_NUMBER >= 9000
+static const char *cputune_xml(xmlNodePtr root, struct domain *dominfo)
+{
+ struct vcpu_device *vcpu;
+ xmlNodePtr cputune, tmp;
+ int ret;
+ char *string = NULL;
+
+ if (dominfo->dev_vcpu == NULL)
+ return NULL;
+
+ vcpu = &dominfo->dev_vcpu[0].dev.vcpu;
+
+ /* CPU cgroup setting saved by libvirt under <cputune> XML section */
+ cputune = xmlNewChild(root, NULL, BAD_CAST "cputune", NULL);
+ if (cputune == NULL)
+ return XML_ERROR;
+
+ /* Get the CPU cgroup setting from the VCPU RASD.Weight property */
+ ret = asprintf(&string,
+ "%d",
+ vcpu->weight);
+ if (ret == -1)
+ return XML_ERROR;
+
+ tmp = xmlNewChild(cputune,
+ NULL,
+ BAD_CAST "shares",
+ BAD_CAST string);
+ free(string);
+
+ if (tmp == NULL)
+ return XML_ERROR;
+ else
+ return NULL;
+}
+#endif
+
static const char *mem_xml(xmlNodePtr root, struct domain *dominfo)
{
struct mem_device *mem;
@@ -941,6 +979,13 @@ char *system_to_xml(struct domain *dominfo)
if (msg != NULL)
goto out;
+#if LIBVIR_VERSION_NUMBER >= 9000
+ /* Recent libvirt versions add new <cputune> section to XML */
+ msg = cputune_xml(root, dominfo);
+ if (msg != NULL)
+ goto out;
+#endif
+
devices = xmlNewChild(root, NULL, BAD_CAST "devices", NULL);
if (devices == NULL) {
msg = XML_ERROR;
diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c
index e1f1cec..098b07a 100644
--- a/src/Virt_ComputerSystem.c
+++ b/src/Virt_ComputerSystem.c
@@ -861,6 +861,11 @@ static int lxc_scheduler_params(struct infostore_ctx *ctx,
static int kvm_scheduler_params(struct infostore_ctx *ctx,
virSchedParameter **params)
{
+#if LIBVIR_VERSION_NUMBER < 9000
+ /* Old versions of libvirt only support CPU cgroups for running guests */
+ /* so instead read cpu cgroup setting for inactive guest from infostore. */
+ /* New versions there is nothing to do because libvirt takes care of it. */
+
unsigned long long value;
*params = calloc(1, sizeof(virSchedParameter));
@@ -878,6 +883,7 @@ static int kvm_scheduler_params(struct infostore_ctx *ctx,
return 1;
}
+#endif
return 0;
}
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
index 9305c8d..0a2de7f 100644
--- a/src/Virt_RASD.c
+++ b/src/Virt_RASD.c
@@ -157,8 +157,12 @@ static CMPIStatus set_proc_rasd_params(const CMPIBroker *broker,
goto out;
}
- /* Currently only support CPU cgroups for running KVM guests */
+ /* Early versions of libvirt only support CPU cgroups for *running* KVM guests */
+#if LIBVIR_VERSION_NUMBER < 9000
if (domain_online(dom) && STREQC(virConnectGetType(conn), "QEMU")) {
+#else
+ if (STREQC(virConnectGetType(conn), "QEMU")) {
+#endif
char *sched;
int nparams;
unsigned int i;
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
index 21979c3..f6b191e 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1783,7 +1783,37 @@ static CMPIStatus update_dominfo(const struct domain *dominfo,
goto out;
}
+#if LIBVIR_VERSION_NUMBER < 9000
+ /* Old libvirt versions dont save cpu cgroup setting for inactive */
+ /* guests, so save in infostore instead */
infostore_set_u64(ctx, "weight", dev->dev.vcpu.weight);
+#else
+ /* New libvirt versions save cpu cgroup setting in KVM guest config */
+ if (STREQC(virConnectGetType(conn), "QEMU")) {
+ int ret;
+ virSchedParameter params;
+ strncpy(params.field,
+ "cpu_shares",
+ VIR_DOMAIN_SCHED_FIELD_LENGTH);
+ params.type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
+ params.value.ul = dev->dev.vcpu.weight;
+
+ CU_DEBUG("setting %s scheduler param cpu_shares=%d",
+ dominfo->name,
+ dev->dev.vcpu.weight);
+ ret = virDomainSetSchedulerParametersFlags(dom, ¶ms, 1,
+ VIR_DOMAIN_AFFECT_CONFIG);
+ if (ret != 0) {
+ CU_DEBUG("Failed to set config scheduler param");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to set config scheduler param");
+ goto out;
+ }
+ }
+ else
+ infostore_set_u64(ctx, "weight", dev->dev.vcpu.weight);
+#endif
infostore_set_u64(ctx, "limit", dev->dev.vcpu.limit);
out:
--
1.7.1
13 years
Comply with make distcheck
by Eduardo Lima (Etrunko)
This is a simple patch series that makes the build pass make distcheck. I tried
(not much) to make the tests at least build, without success. This way I simply
considered them broken and removed from the source tree.
Best regards, Etrunko
13 years
[PATCH] Update .gitignore
by Eduardo Lima (Etrunko)
From: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
---
.gitignore | 42 ++++++++++++++----------------------------
1 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/.gitignore b/.gitignore
index f68ff08..fa1066c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,12 @@ syntax: glob
*.patch
*~
*.o
+*.la
+*.lo
+.libs
+Makefile.in
+Makefile
+config.*
tests/*.err
doc/*.html
.changeset
@@ -14,31 +20,11 @@ doc/*.html
xml_parse_test
cim_schema_*.zip
install_base_schema.sh
-
-syntax: regexp
-.*\#.*\#$
-Makefile$
-Makefile\.in$
-^aclocal\.m4$
-autom4te\.cache/.*
-config\.guess$
-config\.h$
-config\.log$
-config\.status$
-config\.sub$
-^configure$
-^install-sh$
-^ltmain.sh$
-^missing$
-\.libs/.*
-\.la$
-\.lo$
-\.o$
-^stamp-h1$
-^libtool$
-.*\~$
-.*\.loT$
-^acinclude.m4.orig$
-^config.h.in$
-libcmpiutil/doc/html/.*%
-
+aclocal.m4
+autom4te.cache
+configure
+install-sh
+libtool
+ltmain.sh
+missing
+stamp-h1
--
1.7.4.4
13 years
[PATCH v2 00/15] libvirt-cim vlan extension
by Wayne Xia
These patches would do following things: building up the network system CIM
model, building up basic framework and functions below to implement the
configuration, add the bridge and vlan802.1.q configuration capabilities in
CIM model and library below.
Now this patch implement the functionalities with commandline style, which
means it depends on command ip, ifconfig, brctl and /proc/net/vlan/. In this
way it is very sensitive to these command's output format. Maybe another
implemetion could avoid that in the future.
Since libvirt-cim is not a daemon program that would always be brought up
when the emulator was up, so there lacks a mechnism to save the configuration
and set them when system reboot, so these patch uses system directory
/etc/sysconfig/network-script/
to store the settings.
The things above means that a linux kernel later than 2.6 and RedHat
distribution is needed. Other distriution may work but not tested. If
the implemention goes to libvirt the restrict would be removed.
Related profiles: the most important are DSP1050, DSP1097, DSP 2025(draft),
Other are: DSP1041, DSP1014.
Typical usage: assuming you have pNIC eth0. Use following xml files passed
to wbemexec could create bridge testbr with eth0.10 attached, which means all
VMs connecting to testbr would have access to IEEE802.1.q vlan 10.
v2: Changed the eth type defines to filter out lo, sit logical devices.
Removed the ifconfig command.
The patches could be got from following url
https://gitorious.org/~xiaxia347/libvirt-cim/xiawenc
direct git repo is
git://gitorious.org/~xiaxia347/libvirt-cim/xiawenc.git.
XML 1
<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0">
<MESSAGE ID="4711" PROTOCOLVERSION="1.0">
<SIMPLEREQ>
<METHODCALL NAME="DefineSystem">
<LOCALINSTANCEPATH>
<LOCALNAMESPACEPATH>
<NAMESPACE NAME="root"></NAMESPACE><NAMESPACE NAME="virt"></NAMESPACE>
</LOCALNAMESPACEPATH>
<INSTANCENAME CLASSNAME="Net_VirtualEthernetSwitchSystemManagementService">
<KEYBINDING NAME="CreationClassName"><KEYVALUE VALUETYPE="string">Net_VirtualEthernetSwitchSystemManagementService</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="Name"><KEYVALUE VALUETYPE="string">Management Service</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="SystemCreationClassName"><KEYVALUE VALUETYPE="string">KVM_HostSystem</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="SystemName"><KEYVALUE VALUETYPE="string">unknown</KEYVALUE></KEYBINDING>
</INSTANCENAME>
</LOCALINSTANCEPATH>
<PARAMVALUE NAME="SystemSettings" PARAMTYPE="string">
<VALUE>
instance of Net_VirtualEthernetSwitchSystemSettingData {
VirtualSystemIdentifier ="VS_testbr1";
STP = 1;
};
</VALUE>
</PARAMVALUE>
</METHODCALL>
</SIMPLEREQ>
</MESSAGE>
</CIM>
XML 2
<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0">
<MESSAGE ID="4711" PROTOCOLVERSION="1.0">
<SIMPLEREQ>
<METHODCALL NAME="AddResourceSettings">
<LOCALINSTANCEPATH>
<LOCALNAMESPACEPATH>
<NAMESPACE NAME="root"></NAMESPACE><NAMESPACE NAME="virt"></NAMESPACE>
</LOCALNAMESPACEPATH>
<INSTANCENAME CLASSNAME="Net_VirtualEthernetSwitchSystemManagementService">
<KEYBINDING NAME="CreationClassName"><KEYVALUE VALUETYPE="string">Net_VirtualEthernetSwitchSystemManagementService</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="Name"><KEYVALUE VALUETYPE="string">Management Service</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="SystemCreationClassName"><KEYVALUE VALUETYPE="string">KVM_HostSystem</KEYVALUE></KEYBINDING>
<KEYBINDING NAME="SystemName"><KEYVALUE VALUETYPE="string">unknown</KEYVALUE></KEYBINDING>
</INSTANCENAME>
</LOCALINSTANCEPATH>
<PARAMVALUE NAME="AffectedConfiguration">
<VALUE.REFERENCE>
<INSTANCENAME CLASSNAME="Net_VirtualEthernetSwitchSettingData">
<KEYBINDING NAME="InstanceID"><KEYVALUE VALUETYPE="string">Virt:VS_eth0</KEYVALUE></KEYBINDING>
</INSTANCENAME>
</VALUE.REFERENCE>
</PARAMVALUE>
<PARAMVALUE NAME="ResourceSettings" PARAMTYPE="string">
<VALUE.ARRAY>
<VALUE>
instance of Net_EthernetPortAllocationSettingData {
InstanceID = "VS_eth0/EA_eth0.10";
ElementName = "EA_eth0.10";
VLANType = 1;
Connection = {"VLAN10"};
ReorderHdr = 0;
};
</VALUE>
<VALUE>
instance of Net_EthernetPortAllocationSettingData {
InstanceID = "VS_eth0/EC_eth0.10";
HostResource = {"VS_testbr1"};
Parent = "EA_eth0.10";
};
</VALUE>
</VALUE.ARRAY>
</PARAMVALUE>
</METHODCALL>
</SIMPLEREQ>
</MESSAGE>
</CIM>
Wayne Xia (15):
vlan extension - Makefile change
vlan extension - CIM model - add class VESS
vlan extension - CIM model - add class VESSSD
vlan extension - CIM model - add class EthernetPort
vlan extension - CIM model - add class EASD
vlan extension - CIM model - add association SDS
vlan extension - CIM model - add association VESSD
vlan extension - CIM model - add association VESSSDComponent
vlan extension - CIM model - add association ESD
vlan extension - CIM model - add core class VESSMS
vlan extension - CIM model - add help functions
vlan extension - function lib - add the API
vlan extension - function lib - add the core structures
vlan extension - function lib - add the helper
vlan extension - function lib - add the implemention of cmd line
Makefile.am | 16 +-
libxkutil/Makefile.am | 11 +-
libxkutil/host_network_API.c | 182 ++
libxkutil/host_network_API.h | 32 +
libxkutil/host_network_basic.c | 657 +++++++
libxkutil/host_network_basic.h | 168 ++
libxkutil/host_network_error.h | 28 +
libxkutil/host_network_helper.c | 659 +++++++
libxkutil/host_network_helper.h | 192 ++
libxkutil/host_network_implement_cmdline.c | 1835 ++++++++++++++++++++
libxkutil/host_network_implement_cmdline.h | 52 +
libxkutil/network_model.c | 466 +++++
libxkutil/network_model.h | 105 ++
schema/ElementSettingData.mof | 16 +-
schema/ElementSettingData.registration | 4 +-
schema/EthernetPort.mof | 4 +
schema/EthernetPort.registration | 3 +
schema/EthernetPortAllocationSettingData.mof | 21 +
.../EthernetPortAllocationSettingData.registration | 3 +
schema/SettingsDefineState.mof | 9 +-
schema/SettingsDefineState.registration | 3 +-
schema/SystemDevice.mof | 18 +-
schema/SystemDevice.registration | 3 +-
schema/VESSSDComponent.mof | 8 +
schema/VESSSDComponent.registration | 3 +
schema/VirtualEthernetSwitchSystem.mof | 10 +
schema/VirtualEthernetSwitchSystem.registration | 3 +
...irtualEthernetSwitchSystemManagementService.mof | 14 +
...ernetSwitchSystemManagementService.registration | 3 +
schema/VirtualEthernetSwitchSystemSettingData.mof | 27 +
...ualEthernetSwitchSystemSettingData.registration | 3 +
src/Makefile.am | 49 +-
src/Virt_EASD.c | 732 ++++++++
src/Virt_EASD.h | 61 +
src/Virt_ElementSettingData.c | 229 +++-
src/Virt_EthernetPort.c | 565 ++++++
src/Virt_EthernetPort.h | 58 +
src/Virt_HostSystem.c | 2 +-
src/Virt_HostSystem.h | 2 +
src/Virt_SettingsDefineState.c | 256 +++
src/Virt_SystemDevice.c | 126 ++
src/Virt_VESSSD.c | 373 ++++
src/Virt_VESSSD.h | 39 +
src/Virt_VESSSDComponent.c | 181 ++
src/Virt_VirtualEthernetSwitchSystem.c | 483 +++++
src/Virt_VirtualEthernetSwitchSystem.h | 52 +
..._VirtualEthernetSwitchSystemManagementService.c | 1345 ++++++++++++++
..._VirtualEthernetSwitchSystemManagementService.h | 31 +
src/Virt_VirtualSystemManagementService.c | 17 +-
src/Virt_VirtualSystemManagementService.h | 10 +
50 files changed, 9140 insertions(+), 29 deletions(-)
create mode 100644 libxkutil/host_network_API.c
create mode 100644 libxkutil/host_network_API.h
create mode 100644 libxkutil/host_network_basic.c
create mode 100644 libxkutil/host_network_basic.h
create mode 100644 libxkutil/host_network_error.h
create mode 100644 libxkutil/host_network_helper.c
create mode 100644 libxkutil/host_network_helper.h
create mode 100644 libxkutil/host_network_implement_cmdline.c
create mode 100644 libxkutil/host_network_implement_cmdline.h
create mode 100644 libxkutil/network_model.c
create mode 100644 libxkutil/network_model.h
create mode 100644 schema/EthernetPort.mof
create mode 100644 schema/EthernetPort.registration
create mode 100644 schema/EthernetPortAllocationSettingData.mof
create mode 100644 schema/EthernetPortAllocationSettingData.registration
create mode 100644 schema/VESSSDComponent.mof
create mode 100644 schema/VESSSDComponent.registration
create mode 100644 schema/VirtualEthernetSwitchSystem.mof
create mode 100644 schema/VirtualEthernetSwitchSystem.registration
create mode 100644 schema/VirtualEthernetSwitchSystemManagementService.mof
create mode 100644 schema/VirtualEthernetSwitchSystemManagementService.registration
create mode 100644 schema/VirtualEthernetSwitchSystemSettingData.mof
create mode 100644 schema/VirtualEthernetSwitchSystemSettingData.registration
create mode 100644 src/Virt_EASD.c
create mode 100644 src/Virt_EASD.h
create mode 100644 src/Virt_EthernetPort.c
create mode 100644 src/Virt_EthernetPort.h
create mode 100644 src/Virt_VESSSD.c
create mode 100644 src/Virt_VESSSD.h
create mode 100644 src/Virt_VESSSDComponent.c
create mode 100644 src/Virt_VirtualEthernetSwitchSystem.c
create mode 100644 src/Virt_VirtualEthernetSwitchSystem.h
create mode 100644 src/Virt_VirtualEthernetSwitchSystemManagementService.c
create mode 100644 src/Virt_VirtualEthernetSwitchSystemManagementService.h
--
1.7.6
13 years
RFC : Introducing new CIM_RES_TYPE for 9pfs support on QEMU/KVM environment
by Deepak Shetty
Hi All,
I need some help and inputs on the below.
1) I am looking at adding support for 9pfs ( 9p file system) in
libvirt-cim. NOTE the support for the same already exists in libvirt &
qemu.
2) Using 9pfs support, user can export a host file system to the guest (
domain). It uses the virtio framework, so its a passthru file system.
NOTE: This support is exported as a 9p-virtio-device to the guest. Each
host export path is exported as a pseudo 9p device to the guest.
NOTE: This is currently supported only in qemu/kvm environment.
3) The xml tags related to 9pfs in libvirt are... an example below...
<filesystem type='mount'>
<driver type='handle'/>
<source dir='/tmp/virt1'/>
<target dir='test-lib'/>
<alias name='fs0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</filesystem>
The <filesystem> node comes directly under the <domain> node.
My approach for introducing 9pfs support in libvirt-cim is ...
1) Add a new CIM res type, eg; CIM_RES_TYPE_9PFS, is this ok ?
2) Add appropriate handlers for the above new resource type
3) Add new members in struct domain for representing this new device type.
4) Add appropriate xml parsing generation tags for the new resource type.
5) I probably need to add something like
KVM_9PFSResourceAllocationSettingData -- I am not very clear on this yet.
Need some help on how to do this ?
Would appreciate inputs.
thanx,
deepak
13 years
Release of libvirt-cim-0.5.15
by Chip Vincent
I'm happy announce the release of libvirt-cim-0.5.15.
The new release is available at:
ftp://libvirt.org/libvirt-cim/libvirt-cim-0.5.15.tar.gz
libvirt-cim-0.5.15:
* Fix include path (Eduardo Lima (Etrunko))
* xmlgen: Avoid double-free (Eduardo Lima (Etrunko))
* Fix possible use of uninitialized variables (Eduardo Lima (Etrunko))
* Fix misuse of signed variables (Eduardo Lima (Etrunko))
* Avoid NULL dereferences in various providers (Eduardo Lima (Etrunko))
* ACL: Plug leaks (Eduardo Lima (Etrunko))
* device_parsing: Avoid NULL dereferences (Eduardo Lima (Etrunko))
* pool_parsing: Avoid NULL dereferences (Eduardo Lima (Etrunko))
* acl_parsing: Avoid NULL dereference (Eduardo Lima (Etrunko))
* Avoid connection to libvirt if previous attempt fails (Eduardo
Lima (Etrunko))
* Fix qos bug in primordial Network/0 pool (Gareth S. Bestor)
* Rename .hgignore -> .gitignore (Chip Vincent)
* Update autoconfiscate.sh to use git (Chip Vincent)
* Add network qos (bandwidth) support for KVM guests (Gareth Bestor)
* /dev/null should not be passed as source dev for cdrom device.
(Sharad Mishra)
* Add support for libvirt CPU cgroup for active KVM guests (Gareth
S. Bestor)
* FilterEntry: Set HdrProtocolID8021 property (Eduardo Lima (Etrunko))
* FilterEntry: Fix behavior of convert_ip_rule_to_instance (Eduardo
Lima (Etrunko))
* FilterEntry: Support for mask in CIDR notation (Eduardo Lima
(Etrunko))
* FilterEntry: Should be using srcipaddr instead of srcmacaddr
(Eduardo Lima (Etrunko))
* acl_parsing: Share code for icmp and icmp rule types (Eduardo Lima
(Etrunko))
* Pool names with space do not get parsed properly. (Sharad Mishra)
* VirtualSystemManagementService: Avoid extra connection to libvirt
(Eduardo Lima (Etrunko))
* (#2) Fix the problem that libvirt-cim can't find cdrom device that
do not have disk (Wayne Xia)
* device_parsing: Small code cleanup (Eduardo Lima (Etrunko))
* device_parsing: Use default values for vnc graphics device
(Eduardo Lima (Etrunko))
* ACL: Add KVM_FilterEntry class (Eduardo Lima (Etrunko))
* Fix MOF download location - URL permanently changed (Chip Vincent)
* Redirect stdout & stderr when run as out-of-process provider (Chip
Vincent)
* (#2) Return migration job status in CIM_ConcreteJob.ErrorCode
(Sharad Mishra)
* ACL: Add 'Action' property to KVM_{IPHeaders,Hdr8021}Filter
(Eduardo Lima (Etrunko))
* (#2) Workaround to fix race condition around libvirt init. (Sharad
Mishra)
* VirtualSystemManagementService: Fix yet another possible leak
(Eduardo Lima (Etrunko))
* VirtualSystemManagementService: Fixing potential null dereferences
(Eduardo Lima (Etrunko))
* device_parsing: Fixing potential leaks (Eduardo Lima (Etrunko))
* Patches for Virt_SettingsDefineCapabilities: incorrect Default
Value... (Gareth S. Bestor)
* (#5) add sdl frame buffer support. (Wayne Xia)
* (#5) made the graphic structure as union (Wayne Xia)
* acl_parsing: Fixing potential leaks (Eduardo Lima (Etrunko))
* Check to see if stream is non-null before closing. (Sharad Mishra)
* Retrun object paths for newly created filter associations. (Chip
Vincent)
* New entry "poolid" was not getting DUPed. (Sharad Mishra)
* Fix connection leak introduced in patch 1119. (Sharad Mishra)
--
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent(a)linux.vnet.ibm.com
13 years
[TEST] Unable to run cimtest on qemu kvm setup
by Deepak Shetty
dpkshetty@deepak-ThinkPad-T60p
:~/work/cimtest/cimtest$ sudo
CIM_NS=root/virt CIM_USER=root CIM_PASS=****** ./runtests libvirt-cim
-i localhost -c -d -v KVM -g ComputerSys
tem -t 04_defineStartVS.py
Starting test suite: libvirt-cim
Traceback (most recent call last):
File "main.py", line 42, in <module>
from XenKvmLib.common_util import create_netpool_conf,
destroy_netpool, \
File "./lib/XenKvmLib/common_util.py", line 31, in <module>
from XenKvmLib.test_xml import *
File "./lib/XenKvmLib/test_xml.py", line 32, in <module>
from xml import xpath
ImportError: cannot import name xpath
I have all the pre-req installed as mentioned on the
http://wiki.libvirt.org/page/Cimtest_setup
<http://wiki.libvirt.org/page/Cimtest_setup> wiki.
there is no pyxml eq. on ubuntu ( I am on ubuntu host) but i do have
these...
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$ dpkg -l | grep
python | grep xml
ii python-libxml2 2.7.8.dfsg-2
Python bindings for the GNOME XML library
ii python-lxml 2.3-0.1
pythonic binding for the libxml2 and libxslt libraries
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$ dpkg -l | grep
python2
ii libpython2.7 2.7.1-5ubuntu2
Shared Python runtime library (version 2.7)
ii python2.6 2.6.6-6ubuntu7
An interactive high-level object-oriented language
(version 2.6)
ii python2.6-minimal 2.6.6-6ubuntu7
A minimal subset of the Python language (version 2.6)
ii python2.7 2.7.1-5ubuntu2
An interactive high-level object-oriented language
(version 2.7)
ii python2.7-dev 2.7.1-5ubuntu2
Header files and a static library for Python (v2.7)
ii python2.7-minimal 2.7.1-5ubuntu2
A minimal subset of the Python language (version 2.7)
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$ dpkg -l | grep wbem
ii python-pywbem 0.7.0-4
Python WBEM Client and Provider Interface
dpkshetty@deepak-ThinkPad-T60p:~/work/cimtest/cimtest$
Can someone help or tell me what am I missing ?
My aim is to invole the create/define system flow via libvirt-cim.
thanx,
deepak
13 years