+1
Sharad Mishra
System x Enablement
Linux Technology Center
IBM
Kaitlin Rupert
<kaitlin(a)linux.vn
et.ibm.com> To
Sent by: libvirt-cim(a)redhat.com
libvirt-cim-bounc cc
es(a)redhat.com
Subject
[Libvirt-cim] [PATCH 1 of 3] Add
01/28/2010 03:58 new device field to net device
PM struct
Please respond to
List for
discussion and
development of
libvirt CIM
<libvirt-cim@redh
at.com>
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1264722331 28800
# Node ID 9532502f5d5e76efa998c4b6c9339cf47f91b914
# Parent b57ba34c0932d77e11f65282dec5c2094d6ba818
Add new device field to net device struct
This field will be used to hold the target device of the network interface
device. This patch also includes support for parsing a guest XML to get
an already defined target device, as well as code for generating XML with
a target device specified.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b57ba34c0932 -r 9532502f5d5e libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Jan 13 12:45:15 2010 -0800
+++ b/libxkutil/device_parsing.c Thu Jan 28 15:45:31 2010 -0800
@@ -64,6 +64,7 @@
free(dev->mac);
free(dev->source);
free(dev->model);
+ free(dev->device);
}
static void cleanup_emu_device(struct emu_device *dev)
@@ -311,6 +312,10 @@
if (ndev->source != NULL)
continue;
goto err;
+ } else if (XSTREQ(child->name, "target")) {
+ ndev->device = get_attr_value(child, "dev");
+ if (ndev->device == NULL)
+ goto err;
} else if (XSTREQ(child->name, "model")) {
ndev->model = get_attr_value(child, "type");
if (ndev->model == NULL)
@@ -660,6 +665,7 @@
DUP_FIELD(dev, _dev, dev.net.type);
DUP_FIELD(dev, _dev, dev.net.source);
DUP_FIELD(dev, _dev, dev.net.model);
+ DUP_FIELD(dev, _dev, dev.net.device);
} else if (dev->type == CIM_RES_TYPE_DISK) {
DUP_FIELD(dev, _dev, dev.disk.type);
DUP_FIELD(dev, _dev, dev.disk.device);
diff -r b57ba34c0932 -r 9532502f5d5e libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Wed Jan 13 12:45:15 2010 -0800
+++ b/libxkutil/device_parsing.h Thu Jan 28 15:45:31 2010 -0800
@@ -50,6 +50,7 @@
char *mac;
char *source;
char *model;
+ char *device;
};
struct mem_device {
diff -r b57ba34c0932 -r 9532502f5d5e libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Jan 13 12:45:15 2010 -0800
+++ b/libxkutil/xmlgen.c Thu Jan 28 15:45:31 2010 -0800
@@ -217,6 +217,14 @@
return XML_ERROR;
xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac);
+ if (net->device != NULL) {
+ tmp = xmlNewChild(nic, NULL, BAD_CAST "target",
NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+ xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST net->
device);
+ }
+
+
if (net->model != NULL) {
tmp = xmlNewChild(nic, NULL, BAD_CAST "model",
NULL);
if (tmp == NULL)
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim