# HG changeset patch
# User snmishra(a)us.ibm.com
# Date 1245184531 25200
# Node ID 27f3f7f05eb78bd009451009ac7c472f0ffa9332
# Parent a57141febd4a5b6dbae71e96b16264dd1240642d
Add support for bridge type NICs.
Code was added to parse input and generate
libvirt XML to support bridge devices.
Net_RASD mof was updated to add bridge device name.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r a57141febd4a -r 27f3f7f05eb7 libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Fri Jun 12 16:14:40 2009 -0700
+++ b/libxkutil/device_parsing.h Tue Jun 16 13:35:31 2009 -0700
@@ -47,6 +47,7 @@
char *mac;
char *source;
char *model;
+ char *name;
};
struct mem_device {
diff -r a57141febd4a -r 27f3f7f05eb7 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Fri Jun 12 16:14:40 2009 -0700
+++ b/libxkutil/xmlgen.c Tue Jun 16 13:35:31 2009 -0700
@@ -168,7 +168,12 @@
tmp = xmlNewChild(nic, NULL, BAD_CAST "source", NULL);
if (tmp == NULL)
return XML_ERROR;
- xmlNewProp(tmp, BAD_CAST src_type, BAD_CAST dev->source);
+ if (STREQC(src_type, "bridge")) {
+ xmlNewProp(tmp, BAD_CAST src_type, BAD_CAST dev->name);
+ } else {
+ xmlNewProp(tmp, BAD_CAST src_type,
+ BAD_CAST dev->source);
+ }
}
return NULL;
@@ -225,7 +230,7 @@
if (STREQ(dev->dev.net.type, "network"))
msg = set_net_source(nic, net, "network");
else if (STREQ(dev->dev.net.type, "bridge"))
- msg = bridge_net_to_xml(root, net);
+ msg = bridge_net_to_xml(nic, net);
else if (STREQ(dev->dev.net.type, "user"))
continue;
else
diff -r a57141febd4a -r 27f3f7f05eb7 schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Fri Jun 12 16:14:40 2009 -0700
+++ b/schema/ResourceAllocationSettingData.mof Tue Jun 16 13:35:31 2009 -0700
@@ -57,6 +57,10 @@
[Description ("Interface type")]
string NetworkType;
+ [Description ("Bridge name")]
+ string NetworkName;
+
+
};
[Description ("KVM virtual network configuration"),
@@ -68,6 +72,9 @@
[Description ("Interface type")]
string NetworkType;
+ [Description ("Bridge name")]
+ string NetworkName;
+
};
[Description ("LXC virtual network configuration"),
diff -r a57141febd4a -r 27f3f7f05eb7 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Jun 12 16:14:40 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Jun 16 13:35:31 2009 -0700
@@ -59,6 +59,7 @@
#define DEFAULT_MAC_PREFIX "00:16:3e"
#define DEFAULT_XEN_WEIGHT 1024
+#define BRIDGE_TYPE "bridge"
const static CMPIBroker *_BROKER;
@@ -553,7 +554,20 @@
dev->id = strdup(dev->dev.net.mac);
free(dev->dev.net.type);
- dev->dev.net.type = strdup("network");
+ if (cu_get_str_prop(inst, "NetworkType", &val) == CMPI_RC_OK) {
+ if (STREQC(val, BRIDGE_TYPE)) {
+ dev->dev.net.type = strdup(BRIDGE_TYPE);
+ if (cu_get_str_prop(inst, "NetworkName", &val) ==
+ CMPI_RC_OK) {
+ dev->dev.net.name = strdup(val);
+ } else {
+ return "No Network bridge name specified";
+ }
+ } else {
+ dev->dev.net.type = strdup("network");
+ }
+ }
+
if (cu_get_str_prop(inst, "PoolID", &val) != CMPI_RC_OK)
val = _default_network(inst, ns);