
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240250416 25200 # Node ID bca16d22da253f390a74fb08d4f61f7419308dba # Parent 146ed7d63fbbc2edc78660ddc6ecc393ee61739c Add support for parsing and generating XML for the NIC model type tag Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 146ed7d63fbb -r bca16d22da25 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Thu Apr 16 11:20:21 2009 -0700 +++ b/libxkutil/device_parsing.c Mon Apr 20 11:00:16 2009 -0700 @@ -66,6 +66,7 @@ free(dev->type); free(dev->mac); free(dev->source); + free(dev->model); } 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, "model")) { + ndev->model = get_attr_value(child, "type"); + if (ndev->model == NULL) + goto err; } } diff -r 146ed7d63fbb -r bca16d22da25 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Thu Apr 16 11:20:21 2009 -0700 +++ b/libxkutil/device_parsing.h Mon Apr 20 11:00:16 2009 -0700 @@ -45,6 +45,7 @@ char *type; char *mac; char *source; + char *model; }; struct mem_device { diff -r 146ed7d63fbb -r bca16d22da25 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Thu Apr 16 11:20:21 2009 -0700 +++ b/libxkutil/xmlgen.c Mon Apr 20 11:00:16 2009 -0700 @@ -210,6 +210,13 @@ return XML_ERROR; xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac); + if (net->model != NULL) { + tmp = xmlNewChild(nic, NULL, BAD_CAST "model", NULL); + if (tmp == NULL) + return XML_ERROR; + xmlNewProp(tmp, BAD_CAST "type", BAD_CAST net->model); + } + if (STREQ(dev->dev.net.type, "network")) msg = set_net_source(nic, net, "network"); else if (STREQ(dev->dev.net.type, "bridge"))