[Libvir] [PATCH] Cut out "type=ioemu" on Xen3.1

Saori Fukuta fukuta.saori at jp.fujitsu.com
Thu May 31 08:38:02 UTC 2007


Hi,

The definition of (type ioemu) is *not* required by Xen3.1.
So I cut out it when xendConfigVersion is 4 or later.

Signed-off-by: Saori Fukuta <fukuta.saori at jp.fujitsu.com>

Thanks,
Saori Fukuta.

Index: xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.73
diff -u -p -r1.73 xml.c
--- xml.c       23 Apr 2007 07:41:23 -0000      1.73
+++ xml.c       31 May 2007 07:02:01 -0000
@@ -1047,6 +1047,7 @@ virDomainParseXMLDiskDesc(virConnectPtr
  * @conn: pointer to the hypervisor connection
  * @node: node containing the interface description
  * @buf: a buffer for the result S-Expr
+ * @xendConfigVersion: xend configuration file format
  *
  * Parse the one interface the XML description and add it to the S-Expr in buf
  * This is a temporary interface as the S-Expr interface
@@ -1056,7 +1057,7 @@ virDomainParseXMLDiskDesc(virConnectPtr
  * Returns 0 in case of success, -1 in case of error.
  */
 static int
-virDomainParseXMLIfDesc(virConnectPtr conn ATTRIBUTE_UNUSED, xmlNodePtr node, virBufferPtr buf, int hvm)
+virDomainParseXMLIfDesc(virConnectPtr conn ATTRIBUTE_UNUSED, xmlNodePtr node, virBufferPtr buf, int hvm, int xendConfigVersion)
 {
     xmlNodePtr cur;
     xmlChar *type = NULL;
@@ -1129,7 +1130,8 @@ virDomainParseXMLIfDesc(virConnectPtr co
         virBufferVSprintf(buf, "(script '%s')", script);
     if (ip != NULL)
         virBufferVSprintf(buf, "(ip '%s')", ip);
-    if (hvm)
+    /* HVM type ioemu config for xen < 3.1 */
+    if (hvm && xendConfigVersion < 4)
         virBufferAdd(buf, "(type ioemu)", 12);

     virBufferAdd(buf, ")", 1);
@@ -1335,7 +1337,7 @@ virDomainParseXMLDesc(virConnectPtr conn
     if (nb_nodes > 0) {
         for (i = 0; i < nb_nodes; i++) {
             virBufferAdd(&buf, "(device ", 8);
-            res = virDomainParseXMLIfDesc(conn, nodes[i], &buf, hvm);
+            res = virDomainParseXMLIfDesc(conn, nodes[i], &buf, hvm, xendConfigVersion);
             if (res != 0) {
                free(nodes);
                 goto error;
@@ -1494,7 +1496,7 @@ virParseXMLDevice(virConnectPtr conn, ch
             goto error;
     }
     else if (xmlStrEqual(node->name, BAD_CAST "interface")) {
-        if (virDomainParseXMLIfDesc(conn, node, &buf, hvm) != 0)
+        if (virDomainParseXMLIfDesc(conn, node, &buf, hvm, xendConfigVersion) != 0)
             goto error;
     }
  cleanup:




More information about the libvir-list mailing list