]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Convert XenD SEXPR->XML convesion to new domain XML APIs
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 25 Jul 2008 10:49:33 +0000 (10:49 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 25 Jul 2008 10:49:33 +0000 (10:49 +0000)
45 files changed:
ChangeLog
proxy/Makefile.am
src/domain_conf.c
src/domain_conf.h
src/sexpr.c
src/sexpr.h
src/xend_internal.c
src/xend_internal.h
tests/sexpr2xmldata/sexpr2xml-curmem.xml
tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml
tests/sexpr2xmldata/sexpr2xml-disk-block.xml
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-qcow.xml
tests/sexpr2xmldata/sexpr2xml-disk-drv-blktap-raw.xml
tests/sexpr2xmldata/sexpr2xml-disk-file.xml
tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml
tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml
tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml
tests/sexpr2xmldata/sexpr2xml-fv-sound-all.sexpr
tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml
tests/sexpr2xmldata/sexpr2xml-fv-sound.sexpr
tests/sexpr2xmldata/sexpr2xml-fv-sound.xml
tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml
tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
tests/sexpr2xmldata/sexpr2xml-fv.xml
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml
tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
tests/sexpr2xmldata/sexpr2xml-net-routed.xml
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml
tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml
tests/sexpr2xmldata/sexpr2xml-pv-vfb-orig.xml
tests/sexpr2xmldata/sexpr2xml-pv.xml
tests/sexpr2xmltest.c

index 8a3fd8e22f7aafd549f32692c28c0066ecb882b4..d769ac2d6720c49ddffda9edb8dd0b624794612b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Fri Jul 25 11:45:27 BST 2008 Daniel P. Berrange <berrange@redhat.com>
+
+       Convert XenD SEXPR->XML convesion to new domain XML APIs
+
+       * proxy/Makefile.am: Link to domain XML formatting APIs
+       * src/domain_conf.c, src/domain_conf.h: Disable XML parsing
+       routines when used by proxy
+       * src/sexpr.c, src/sexpr.h: Added sexpr_node_copy() API
+       * src/xend_internal.c, src/xend_internal.h: Convert the
+       SEXPR -> XML conversion routines to use the generic domain
+       XML APIs
+       * tests/sexpr2xmltest.c: Adapt for API changes
+       * tests/sexpr2xmldata/*.xml: Update to take account of
+       re-ordering of XML due to new APIs
+
 Fri Jul 25 10:44:27 BST 2008 Daniel P. Berrange <berrange@redhat.com>
 
        Remove unused/no-op code from xen drivers
index 348be3499d0d550111fbb2bb4c0a48fcc5855d16..80062a825be69588c9bc70c36ca069aa4feb9b1f 100644 (file)
@@ -15,6 +15,7 @@ libvirt_proxy_SOURCES = libvirt_proxy.c @top_srcdir@/src/xend_internal.c \
             @top_srcdir@/src/xs_internal.c @top_srcdir@/src/buf.c \
             @top_srcdir@/src/capabilities.c \
             @top_srcdir@/src/memory.c \
+            @top_srcdir@/src/domain_conf.c \
             @top_srcdir@/src/util.c \
            @top_srcdir@/src/uuid.c
 libvirt_proxy_LDFLAGS = $(WARN_CFLAGS)
index f1396091934959b7899f5e1633f4c7ead7d1fcf4..63466f43e35f7acf900d2df47c6cd96c7c81c11e 100644 (file)
@@ -439,6 +439,7 @@ void virDomainRemoveInactive(virDomainObjPtr *doms,
     virDomainObjFree(dom);
 }
 
+#ifndef PROXY
 static int virDomainDiskCompare(virDomainDiskDefPtr a,
                                 virDomainDiskDefPtr b) {
     if (a->bus == b->bus)
@@ -1916,7 +1917,7 @@ cleanup:
     xmlXPathFreeContext(ctxt);
     return def;
 }
-
+#endif /* ! PROXY */
 
 /************************************************************************
  *                                                                     *
@@ -2695,6 +2696,8 @@ char *virDomainDefFormat(virConnectPtr conn,
 }
 
 
+#ifndef PROXY
+
 int virDomainSaveConfig(virConnectPtr conn,
                         const char *configDir,
                         const char *autostartDir,
@@ -2773,6 +2776,7 @@ int virDomainSaveConfig(virConnectPtr conn,
     return ret;
 }
 
+
 virDomainObjPtr virDomainLoadConfig(virConnectPtr conn,
                                     virCapsPtr caps,
                                     virDomainObjPtr *doms,
@@ -2890,3 +2894,5 @@ int virDomainDeleteConfig(virConnectPtr conn,
 
     return 0;
 }
+
+#endif /* ! PROXY */
index 18fd8188973aea1c0eff314d116cc22c6ac9aeba..b438bc8d703a5df775a2c4d3541325b881797599 100644 (file)
@@ -424,6 +424,7 @@ virDomainObjPtr virDomainAssignDef(virConnectPtr conn,
 void virDomainRemoveInactive(virDomainObjPtr *doms,
                              virDomainObjPtr dom);
 
+#ifndef PROXY
 virDomainDeviceDefPtr virDomainDeviceDefParse(virConnectPtr conn,
                                               const virDomainDefPtr def,
                                               const char *xmlStr);
@@ -437,6 +438,7 @@ virDomainDefPtr virDomainDefParseNode(virConnectPtr conn,
                                       virCapsPtr caps,
                                       xmlDocPtr doc,
                                       xmlNodePtr root);
+#endif
 char *virDomainDefFormat(virConnectPtr conn,
                          virDomainDefPtr def,
                          int flags);
index 8498c8b79387242733859478ce9b90a436880ab2..90c549c1ee62e8a0cece990438a80362c6688056 100644 (file)
@@ -550,6 +550,21 @@ sexpr_node(const struct sexpr *sexpr, const char *node)
     return (n && n->u.s.car->kind == SEXPR_VALUE) ? n->u.s.car->u.value : NULL;
 }
 
+int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst)
+{
+    const char *val = sexpr_node(sexpr, node);
+
+    if (val) {
+        *dst = strdup(val);
+        if (!(*dst))
+            return -1;
+    } else {
+        *dst = NULL;
+    }
+    return 0;
+}
+
+
 /**
  * sexpr_fmt_node:
  * @sexpr: a pointer to a parsed S-Expression
index 0dd882d50a3997b54e06f75d02ae97b3095be325..0559a27c784a2e172795dd7fb756a7364cd8a4bd 100644 (file)
@@ -47,6 +47,7 @@ void sexpr_free(struct sexpr *sexpr);
 
 /* lookup in S-Expressions */
 const char *sexpr_node(const struct sexpr *sexpr, const char *node);
+int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst);
 const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
   ATTRIBUTE_FORMAT(printf,2,3);
 struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
index 3fe6b7533bc3bfefe911f37174ad127090b9d785..188113b43293707064f367b96cee495faeda9f25 100644 (file)
@@ -40,6 +40,7 @@
 #include "xml.h"
 #include "buf.h"
 #include "capabilities.h"
+#include "domain_conf.h"
 #include "uuid.h"
 #include "xen_unified.h"
 #include "xend_internal.h"
@@ -114,6 +115,8 @@ virXendError(virConnectPtr conn, virErrorNumber error,
         va_start (args, fmt);
         vsnprintf (msg, sizeof (msg), fmt, args);
         va_end (args);
+    } else {
+        msg[0] = '\0';
     }
 
     msg2 = __virErrorMsg (error, fmt ? msg : NULL);
@@ -1205,21 +1208,15 @@ xend_detect_config_version(virConnectPtr conn) {
 
 /*****************************************************************
  ******
- ******
- ******
- ******
-             Needed helper code
- ******
- ******
- ******
+ ****** Parsing of SEXPR into virDomainDef objects
  ******
  *****************************************************************/
 
 /**
- * xend_parse_sexp_desc_os:
+ * xenDaemonParseSxprOS
  * @xend: the xend connection object
  * @node: the root of the parsed S-Expression
- * @buf: output buffer object
+ * @def: the domain config
  * @hvm: true or 1 if no contains HVM S-Expression
  * @bootloader: true or 1 if a bootloader is defined
  *
@@ -1228,90 +1225,82 @@ xend_detect_config_version(virConnectPtr conn) {
  * Returns 0 in case of success and -1 in case of error
  */
 static int
-xend_parse_sexp_desc_os(virConnectPtr xend, struct sexpr *node, virBufferPtr buf, int hvm, int bootloader)
+xenDaemonParseSxprOS(virConnectPtr xend, struct sexpr *node,
+                     virDomainDefPtr def,
+                     int hvm)
 {
-    const char *loader = NULL;
-    const char *kernel = NULL;
-    const char *initrd = NULL;
-    const char *cmdline = NULL;
-    const char *root = NULL;
-
-    if (node == NULL || buf == NULL) {
-       return(-1);
-    }
-
-    virBufferAddLit(buf, "  <os>\n");
-    if (hvm)
-        virBufferAddLit(buf, "    <type>hvm</type>\n");
-    else
-        virBufferAddLit(buf, "    <type>linux</type>\n");
-
     if (hvm) {
-        loader = sexpr_node(node, "domain/image/hvm/loader");
-        if (loader == NULL) {
-            loader = sexpr_node(node, "domain/image/hvm/kernel");
+        if (sexpr_node_copy(node, "domain/image/hvm/loader", &def->os.loader) < 0)
+            goto no_memory;
+        if (def->os.loader == NULL) {
+            if (sexpr_node_copy(node, "domain/image/hvm/kernel", &def->os.loader) < 0)
+                goto no_memory;
 
-            if (loader == NULL) {
+            if (def->os.loader == NULL) {
                 virXendError(xend, VIR_ERR_INTERNAL_ERROR,
                              _("domain information incomplete, missing HVM loader"));
                 return(-1);
             }
         } else {
-            kernel = sexpr_node(node, "domain/image/hvm/kernel");
-            initrd = sexpr_node(node, "domain/image/hvm/ramdisk");
-            cmdline = sexpr_node(node, "domain/image/hvm/args");
-            root = sexpr_node(node, "domain/image/hvm/root");
+            if (sexpr_node_copy(node, "domain/image/hvm/kernel", &def->os.kernel) < 0)
+                goto no_memory;
+            if (sexpr_node_copy(node, "domain/image/hvm/ramdisk", &def->os.initrd) < 0)
+                goto no_memory;
+            if (sexpr_node_copy(node, "domain/image/hvm/args", &def->os.cmdline) < 0)
+                goto no_memory;
+            if (sexpr_node_copy(node, "domain/image/hvm/root", &def->os.root) < 0)
+                goto no_memory;
         }
     } else {
-        kernel = sexpr_node(node, "domain/image/linux/kernel");
-        initrd = sexpr_node(node, "domain/image/linux/ramdisk");
-        cmdline = sexpr_node(node, "domain/image/linux/args");
-        root = sexpr_node(node, "domain/image/linux/root");
-    }
-
-    if (hvm)
-        virBufferVSprintf(buf, "    <loader>%s</loader>\n", loader);
-
-    if ((kernel) && ((!loader) || (STRNEQ(kernel, loader)))) {
-        virBufferVSprintf(buf, "    <kernel>%s</kernel>\n", kernel);
-        if (initrd && initrd[0])
-            virBufferVSprintf(buf, "    <initrd>%s</initrd>\n", initrd);
-        if (root && root[0])
-            virBufferVSprintf(buf, "    <root>%s</root>\n", root);
-        if (cmdline && cmdline[0])
-            virBufferEscapeString(buf, "    <cmdline>%s</cmdline>\n", cmdline);
-    } else {
-        if (hvm) {
-            const char *boot = sexpr_node(node, "domain/image/hvm/boot");
-            if ((boot != NULL) && (boot[0] != 0)) {
-                while (*boot) {
-                    if (*boot == 'a')
-                        /* XXX no way to deal with boot from 2nd floppy */
-                        virBufferAddLit(buf, "    <boot dev='fd'/>\n");
-                    else if (*boot == 'c')
-                        /*
-                         * Don't know what to put here.  Say the vm has been given 3
-                         * disks - hda, hdb, hdc.  How does one identify the boot disk?
-                         * We're going to assume that first disk is the boot disk since
-                         * this is most common practice
-                         */
-                        virBufferAddLit(buf, "    <boot dev='hd'/>\n");
-                    else if (*boot == 'd')
-                        virBufferAddLit(buf, "    <boot dev='cdrom'/>\n");
-                    else if (*boot == 'n')
-                        virBufferAddLit(buf, "    <boot dev='network'/>\n");
-                    boot++;
-                }
+        if (sexpr_node_copy(node, "domain/image/linux/kernel", &def->os.kernel) < 0)
+            goto no_memory;
+        if (sexpr_node_copy(node, "domain/image/linux/ramdisk", &def->os.initrd) < 0)
+            goto no_memory;
+        if (sexpr_node_copy(node, "domain/image/linux/args", &def->os.cmdline) < 0)
+            goto no_memory;
+        if (sexpr_node_copy(node, "domain/image/linux/root", &def->os.root) < 0)
+            goto no_memory;
+    }
+
+    /* If HVM kenrel == loader, then old xend, so kill off kernel */
+    if (hvm &&
+        def->os.kernel &&
+        STREQ(def->os.kernel, def->os.loader)) {
+        VIR_FREE(def->os.kernel);
+    }
+
+    if (!def->os.kernel &&
+        hvm) {
+        const char *boot = sexpr_node(node, "domain/image/hvm/boot");
+        if ((boot != NULL) && (boot[0] != 0)) {
+            while (*boot &&
+                   def->os.nBootDevs < VIR_DOMAIN_BOOT_LAST) {
+                if (*boot == 'a')
+                    def->os.bootDevs[def->os.nBootDevs++] = VIR_DOMAIN_BOOT_FLOPPY;
+                else if (*boot == 'c')
+                    def->os.bootDevs[def->os.nBootDevs++] = VIR_DOMAIN_BOOT_DISK;
+                else if (*boot == 'd')
+                    def->os.bootDevs[def->os.nBootDevs++] = VIR_DOMAIN_BOOT_CDROM;
+                else if (*boot == 'n')
+                    def->os.bootDevs[def->os.nBootDevs++] = VIR_DOMAIN_BOOT_NET;
+                boot++;
             }
-        } else if (!bootloader) {
-            virXendError(xend, VIR_ERR_INTERNAL_ERROR,
-                         _("domain information incomplete, missing kernel & bootloader"));
-            return(-1);
         }
     }
 
-    virBufferAddLit(buf, "  </os>\n");
-    return(0);
+    if (!hvm &&
+        !def->os.kernel &&
+        !def->os.bootloader) {
+        virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+                     _("domain information incomplete, missing kernel & bootloader"));
+        return -1;
+    }
+
+    return 0;
+
+no_memory:
+    virXendError(xend, VIR_ERR_NO_MEMORY, NULL);
+    return -1;
 }
 
 
@@ -1538,36 +1527,170 @@ error:
     return ret;
 }
 
-typedef int
-  (*sexp_blockdevs_cb)
-  (virConnectPtr conn, void *data,
-   int isBlock, int cdrom, int isNoSrcCdrom, int hvm,
-   const char *drvName, const char *drvType,
-   const char *src, const char *dst,
-   const char *mode);
+static virDomainChrDefPtr
+xenDaemonParseSxprChar(virConnectPtr conn,
+                       const char *value,
+                       const char *tty)
+{
+    char prefix[10];
+    char *tmp;
+    virDomainChrDefPtr def;
+
+    if (VIR_ALLOC(def) < 0) {
+        virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+        return NULL;
+    }
+
+    strncpy(prefix, value, sizeof(prefix)-1);
+    NUL_TERMINATE(prefix);
+
+    if (value[0] == '/') {
+        def->type = VIR_DOMAIN_CHR_TYPE_DEV;
+    } else {
+        if ((tmp = strchr(prefix, ':')) != NULL) {
+            *tmp = '\0';
+            value += (tmp - prefix) + 1;
+        }
+
+        if (STREQ(prefix, "telnet")) {
+            def->type = VIR_DOMAIN_CHR_TYPE_TCP;
+            def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
+        } else {
+            if ((def->type = virDomainChrTypeFromString(prefix)) < 0) {
+                virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown chr device type '%s'"), prefix);
+                goto error;
+            }
+        }
+    }
+
+    /* Compat with legacy  <console tty='/dev/pts/5'/> syntax */
+    switch (def->type) {
+    case VIR_DOMAIN_CHR_TYPE_PTY:
+        if (tty != NULL &&
+            !(def->data.file.path = strdup(tty)))
+            goto no_memory;
+        break;
+
+    case VIR_DOMAIN_CHR_TYPE_FILE:
+    case VIR_DOMAIN_CHR_TYPE_PIPE:
+        if (!(def->data.file.path = strdup(value)))
+            goto no_memory;
+        break;
+
+    case VIR_DOMAIN_CHR_TYPE_TCP:
+    {
+        const char *offset = strchr(value, ':');
+        const char *offset2;
+
+        if (offset == NULL) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("malformed char device string"));
+            goto error;
+        }
+
+        if (offset != value &&
+            (def->data.tcp.host = strndup(value, offset - value)) == NULL)
+            goto no_memory;
+
+        offset2 = strchr(offset, ',');
+        if (offset2 == NULL)
+            def->data.tcp.service = strdup(offset+1);
+        else
+            def->data.tcp.service = strndup(offset+1, offset2-(offset+1));
+        if (def->data.tcp.service == NULL)
+            goto no_memory;
+
+        if (offset2 && strstr(offset2, ",listen"))
+            def->data.tcp.listen = 1;
+    }
+    break;
+
+    case VIR_DOMAIN_CHR_TYPE_UDP:
+    {
+        const char *offset = strchr(value, ':');
+        const char *offset2, *offset3;
+
+        if (offset == NULL) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("malformed char device string"));
+            goto error;
+        }
+
+        if (offset != value &&
+            (def->data.udp.connectHost = strndup(value, offset - value)) == NULL)
+            goto no_memory;
+
+        offset2 = strchr(offset, '@');
+        if (offset2 != NULL) {
+            if ((def->data.udp.connectService = strndup(offset + 1, offset2-(offset+1))) == NULL)
+                goto no_memory;
+
+            offset3 = strchr(offset2, ':');
+            if (offset3 == NULL) {
+                virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("malformed char device string"));
+                goto error;
+            }
+
+            if (offset3 > (offset2 + 1) &&
+                (def->data.udp.bindHost = strndup(offset2 + 1, offset3 - (offset2+1))) == NULL)
+                goto no_memory;
+
+            if ((def->data.udp.bindService = strdup(offset3 + 1)) == NULL)
+                goto no_memory;
+        } else {
+            if ((def->data.udp.connectService = strdup(offset + 1)) == NULL)
+                goto no_memory;
+        }
+    }
+    break;
+
+    case VIR_DOMAIN_CHR_TYPE_UNIX:
+    {
+        const char *offset = strchr(value, ',');
+        if (offset)
+            def->data.nix.path = strndup(value, (offset - value));
+        else
+            def->data.nix.path = strdup(value);
+        if (def->data.nix.path == NULL)
+            goto no_memory;
+
+        if (offset != NULL &&
+            strstr(offset, ",listen") != NULL)
+            def->data.nix.listen = 1;
+    }
+    break;
+    }
+
+    return def;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+error:
+    virDomainChrDefFree(def);
+    return NULL;
+}
 
 /**
- * xend_parse_sexp_blockdevs:
+ * xend_parse_sexp_desc_disks
  * @conn: connection
  * @root: root sexpr
  * @xendConfigVersion: version of xend
- * @fn: callback function
- * @data: optional data for callback function
  *
- * This parses out block devices from the domain sexpr and calls
- * fn (conn, data, ...) for each block device found.
+ * This parses out block devices from the domain sexpr
  *
  * Returns 0 if successful or -1 if failed.
  */
 static int
-xend_parse_sexp_blockdevs (virConnectPtr conn, struct sexpr *root,
-                           int xendConfigVersion,
-                           sexp_blockdevs_cb fn, void *data)
+xenDaemonParseSxprDisks(virConnectPtr conn,
+                        virDomainDefPtr def,
+                        struct sexpr *root,
+                        int hvm,
+                        int xendConfigVersion)
 {
     struct sexpr *cur, *node;
-    int hvm;
-
-    hvm = sexpr_lookup(root, "domain/image/hvm") ? 1 : 0;
+    virDomainDiskDefPtr disk = NULL, prev = def->disks;
 
     for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
         node = cur->u.s.car;
@@ -1577,12 +1700,6 @@ xend_parse_sexp_blockdevs (virConnectPtr conn, struct sexpr *root,
         if (sexpr_lookup(node, "device/vbd") ||
             sexpr_lookup(node, "device/tap")) {
             char *offset;
-            int ret = -1;
-            int isBlock = 0;
-            int cdrom = 0;
-            int isNoSrcCdrom = 0;
-            char *drvName = NULL;
-            char *drvType = NULL;
             const char *src = NULL;
             const char *dst = NULL;
             const char *mode = NULL;
@@ -1598,84 +1715,84 @@ xend_parse_sexp_blockdevs (virConnectPtr conn, struct sexpr *root,
                 mode = sexpr_node(node, "device/tap/mode");
             }
 
+            if (VIR_ALLOC(disk) < 0)
+                goto no_memory;
+
             if (dst == NULL) {
                 virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                              _("domain information incomplete, vbd has no dev"));
-                goto bad_parse;
+                goto error;
             }
 
             if (src == NULL) {
                 /* There is a case without the uname to the CD-ROM device */
                 offset = strchr(dst, ':');
-                if (offset) {
-                    if (hvm && STREQ(offset, ":cdrom")) {
-                        isNoSrcCdrom = 1;
-                    }
-                    offset[0] = '\0';
-                }
-                if (!isNoSrcCdrom) {
+                if (!offset ||
+                    !hvm ||
+                    STRNEQ(offset, ":cdrom")) {
                     virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                                  _("domain information incomplete, vbd has no src"));
-                    goto bad_parse;
+                    goto error;
                 }
             }
 
-            if (!isNoSrcCdrom) {
+            if (src != NULL) {
                 offset = strchr(src, ':');
                 if (!offset) {
                     virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                                  _("cannot parse vbd filename, missing driver name"));
-                    goto bad_parse;
+                    goto error;
                 }
 
-                if (VIR_ALLOC_N(drvName, (offset-src)+1) < 0) {
-                    virXendError(conn, VIR_ERR_NO_MEMORY,
-                                 _("allocate new buffer"));
-                    goto bad_parse;
-                }
-                strncpy(drvName, src, (offset-src));
-                drvName[offset-src] = '\0';
+                if (VIR_ALLOC_N(disk->driverName, (offset-src)+1) < 0)
+                    goto no_memory;
+                strncpy(disk->driverName, src, (offset-src));
+                disk->driverName[offset-src] = '\0';
 
                 src = offset + 1;
 
-                if (STREQ (drvName, "tap")) {
+                if (STREQ (disk->driverName, "tap")) {
                     offset = strchr(src, ':');
                     if (!offset) {
                         virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                                      _("cannot parse vbd filename, missing driver type"));
-                        goto bad_parse;
+                        goto error;
                     }
 
-                    if (VIR_ALLOC_N(drvType, (offset-src)+1)< 0) {
-                        virXendError(conn, VIR_ERR_NO_MEMORY,
-                                     _("allocate new buffer"));
-                        goto bad_parse;
-                    }
-                    strncpy(drvType, src, (offset-src));
-                    drvType[offset-src] = '\0';
+                    if (VIR_ALLOC_N(disk->driverType, (offset-src)+1)< 0)
+                        goto no_memory;
+                    strncpy(disk->driverType, src, (offset-src));
+                    disk->driverType[offset-src] = '\0';
+
                     src = offset + 1;
                     /* Its possible to use blktap driver for block devs
                        too, but kinda pointless because blkback is better,
                        so we assume common case here. If blktap becomes
                        omnipotent, we can revisit this, perhaps stat()'ing
                        the src file in question */
-                    isBlock = 0;
-                } else if (STREQ(drvName, "phy")) {
-                    isBlock = 1;
-                } else if (STREQ(drvName, "file")) {
-                    isBlock = 0;
+                    disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
+                } else if (STREQ(disk->driverName, "phy")) {
+                    disk->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
+                } else if (STREQ(disk->driverName, "file")) {
+                    disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
                 }
+            } else {
+                /* No CDROM media so can't really tell. We'll just
+                   call if a FILE for now and update when media
+                   is inserted later */
+                disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
             }
 
             if (STREQLEN (dst, "ioemu:", 6))
                 dst += 6;
 
+            disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
             /* New style disk config from Xen >= 3.0.3 */
             if (xendConfigVersion > 1) {
                 offset = strrchr(dst, ':');
                 if (offset) {
                     if (STREQ (offset, ":cdrom")) {
-                        cdrom = 1;
+                        disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
                     } else if (STREQ (offset, ":disk")) {
                         /* The default anyway */
                     } else {
@@ -1685,78 +1802,409 @@ xend_parse_sexp_blockdevs (virConnectPtr conn, struct sexpr *root,
                 }
             }
 
-            /* Call the callback function. */
-            ret = fn (conn, data, isBlock, cdrom, isNoSrcCdrom, hvm,
-                      drvName, drvType, src, dst, mode);
+            if (!(disk->dst = strdup(dst)))
+                goto no_memory;
+            if (src &&
+                !(disk->src = strdup(src)))
+                goto no_memory;
 
-        bad_parse:
-            VIR_FREE(drvName);
-            VIR_FREE(drvType);
+            if (STRPREFIX(disk->dst, "xvd"))
+                disk->bus = VIR_DOMAIN_DISK_BUS_XEN;
+            else if (STRPREFIX(disk->dst, "hd"))
+                disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
+            else if (STRPREFIX(disk->dst, "sd"))
+                disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
+            else
+                disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
+
+            if (mode &&
+                strchr(mode, 'r'))
+                disk->readonly = 1;
+            if (mode &&
+                strchr(mode, '!'))
+                disk->shared = 1;
+
+            if (prev)
+                prev->next = disk;
+            else
+                def->disks = disk;
 
-            if (ret == -1) return -1;
+            prev = disk;
+            disk = NULL;
         }
     }
 
     return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+
+error:
+    virDomainDiskDefFree(disk);
+    return -1;
 }
 
+
 static int
-xend_parse_sexp_desc_blockdev (virConnectPtr conn ATTRIBUTE_UNUSED,
-                               void *data,
-                               int isBlock, int cdrom, int isNoSrcCdrom,
-                               int hvm,
-                               const char *drvName, const char *drvType,
-                               const char *src, const char *dst,
-                               const char *mode)
+xenDaemonParseSxprNets(virConnectPtr conn,
+                       virDomainDefPtr def,
+                       struct sexpr *root)
 {
-    virBuffer *buf = (virBuffer *) data;
-    const char *bus = NULL;
-
-    if (!isNoSrcCdrom) {
-        virBufferVSprintf(buf, "    <disk type='%s' device='%s'>\n",
-                          isBlock ? "block" : "file",
-                          cdrom ? "cdrom" : "disk");
-        if (drvType) {
-            virBufferVSprintf(buf, "      <driver name='%s' type='%s'/>\n", drvName, drvType);
-        } else {
-            virBufferVSprintf(buf, "      <driver name='%s'/>\n", drvName);
+    virDomainNetDefPtr net = NULL, prev = def->nets;
+    struct sexpr *cur, *node;
+    const char *tmp;
+    int vif_index = 0;
+
+    for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
+        node = cur->u.s.car;
+        if (sexpr_lookup(node, "device/vif")) {
+            const char *tmp2, *model;
+            char buf[50];
+            tmp2 = sexpr_node(node, "device/vif/script");
+            tmp = sexpr_node(node, "device/vif/bridge");
+            model = sexpr_node(node, "device/vif/model");
+
+            if (VIR_ALLOC(net) < 0)
+                goto no_memory;
+
+            if ((tmp2 && strstr(tmp2, "bridge")) || tmp) {
+                net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
+                /* XXX virtual network reverse resolve */
+
+                if (tmp &&
+                    !(net->data.bridge.brname = strdup(tmp)))
+                    goto no_memory;
+            } else {
+                net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
+            }
+
+            tmp = sexpr_node(node, "device/vif/vifname");
+            if (!tmp) {
+                snprintf(buf, sizeof(buf), "vif%d.%d", def->id, vif_index);
+                tmp = buf;
+            }
+            if (!(net->ifname = strdup(tmp)))
+                goto no_memory;
+
+            tmp = sexpr_node(node, "device/vif/mac");
+            if (tmp) {
+                unsigned int mac[6];
+                if (sscanf(tmp, "%02x:%02x:%02x:%02x:%02x:%02x",
+                           (unsigned int*)&mac[0],
+                           (unsigned int*)&mac[1],
+                           (unsigned int*)&mac[2],
+                           (unsigned int*)&mac[3],
+                           (unsigned int*)&mac[4],
+                           (unsigned int*)&mac[5]) != 6) {
+                    virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                                 _("malformed mac address '%s'"),
+                                 tmp);
+                    goto cleanup;
+                }
+                net->mac[0] = mac[0];
+                net->mac[1] = mac[1];
+                net->mac[2] = mac[2];
+                net->mac[3] = mac[3];
+                net->mac[4] = mac[4];
+                net->mac[5] = mac[5];
+            }
+
+            tmp = sexpr_node(node, "device/vif/ip");
+            if (tmp &&
+                !(net->data.ethernet.ipaddr = strdup(tmp)))
+                goto no_memory;
+
+            if (tmp2 &&
+                net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
+                !(net->data.ethernet.script = strdup(tmp2)))
+                goto no_memory;
+
+            if (model &&
+                !(net->model = strdup(model)))
+                goto no_memory;
+
+            if (prev)
+                prev->next = net;
+            else
+                def->nets = net;
+            vif_index++;
         }
-        if (isBlock) {
-            virBufferVSprintf(buf, "      <source dev='%s'/>\n", src);
-        } else {
-            virBufferVSprintf(buf, "      <source file='%s'/>\n", src);
+    }
+
+    return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+cleanup:
+    virDomainNetDefFree(net);
+    return -1;
+}
+
+static int
+xenDaemonParseSxprSound(virConnectPtr conn,
+                        virDomainDefPtr def,
+                        const char *str)
+{
+    if (STREQ(str, "all")) {
+        int i;
+        virDomainSoundDefPtr prev = NULL;
+        for (i = 0 ; i < VIR_DOMAIN_SOUND_MODEL_LAST ; i++) {
+            virDomainSoundDefPtr sound;
+            if (VIR_ALLOC(sound) < 0)
+                goto no_memory;
+            sound->model = i;
+            if (prev)
+                prev->next = sound;
+            else
+                def->sounds = sound;
+            prev = sound;
         }
     } else {
-        /* This case is the cdrom device only */
-        virBufferAddLit(buf, "    <disk device='cdrom'>\n");
+        char model[10];
+        const char *offset = str, *offset2;
+        virDomainSoundDefPtr prev = NULL;
+        do {
+            int len;
+            virDomainSoundDefPtr sound;
+            offset2 = strchr(offset, ',');
+            if (offset2)
+                len = (offset2 - offset);
+            else
+                len = strlen(offset);
+            if (len > (sizeof(model)-1)) {
+                virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                                 _("unexpected sound model %s"), offset);
+                goto error;
+            }
+            strncpy(model, offset, len);
+            model[len] = '\0';
+
+            if (VIR_ALLOC(sound) < 0)
+                goto no_memory;
+
+            if ((sound->model = virDomainSoundModelTypeFromString(model)) < 0) {
+                VIR_FREE(sound);
+                goto error;
+            }
+
+            if (prev)
+                prev->next = sound;
+            else
+                def->sounds = sound;
+            prev = sound;
+            offset = offset2 ? offset2 + 1 : NULL;
+        } while (offset);
     }
-    if (STRPREFIX(dst, "xvd") || !hvm) {
-        bus = "xen";
-    } else if (STRPREFIX(dst, "sd")) {
-        bus = "scsi";
-    } else {
-        bus = "ide";
+
+    return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+error:
+    return -1;
+}
+
+
+static int
+xenDaemonParseSxprUSB(virConnectPtr conn,
+                      virDomainDefPtr def,
+                      struct sexpr *root)
+{
+    virDomainInputDefPtr prev = def->inputs;
+    struct sexpr *cur, *node;
+    const char *tmp;
+
+    for (cur = sexpr_lookup(root, "domain/image/hvm"); cur && cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
+        node = cur->u.s.car;
+        if (sexpr_lookup(node, "usbdevice")) {
+            tmp = sexpr_node(node, "usbdevice");
+            if (tmp && *tmp) {
+                if (STREQ(tmp, "tablet") ||
+                    STREQ(tmp, "mouse")) {
+                    virDomainInputDefPtr input;
+                    if (VIR_ALLOC(input) < 0)
+                        goto no_memory;
+                    input->bus = VIR_DOMAIN_INPUT_BUS_USB;
+                    if (STREQ(tmp, "tablet"))
+                        input->type = VIR_DOMAIN_INPUT_TYPE_TABLET;
+                    else
+                        input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
+
+                    if (prev)
+                        prev->next = input;
+                    else
+                        def->inputs = input;
+                    prev = input;
+                } else {
+                    /* XXX Handle other non-input USB devices later */
+                }
+            }
+        }
     }
-    virBufferVSprintf(buf, "      <target dev='%s' bus='%s'/>\n",
-                      dst, bus);
+    return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+    return -1;
+}
+
+static int
+xenDaemonParseSxprGraphicsOld(virConnectPtr conn,
+                              virDomainDefPtr def,
+                              struct sexpr *root,
+                              int hvm,
+                              int xendConfigVersion)
+{
+    const char *tmp;
+    virDomainGraphicsDefPtr graphics = NULL;
+
+    if ((tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux")) &&
+        tmp[0] == '1') {
+        /* Graphics device (HVM, or old (pre-3.0.4) style PV VNC config) */
+        int port = xenStoreDomainGetVNCPort(conn, def->id);
+        const char *listenAddr = sexpr_fmt_node(root, "domain/image/%s/vnclisten", hvm ? "hvm" : "linux");
+        const char *vncPasswd = sexpr_fmt_node(root, "domain/image/%s/vncpasswd", hvm ? "hvm" : "linux");
+        const char *keymap = sexpr_fmt_node(root, "domain/image/%s/keymap", hvm ? "hvm" : "linux");
+        const char *unused = sexpr_fmt_node(root, "domain/image/%s/vncunused", hvm ? "hvm" : "linux");
+
+        if (VIR_ALLOC(graphics) < 0)
+            goto no_memory;
+
+        graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+        /* For Xen >= 3.0.3, don't generate a fixed port mapping
+         * because it will almost certainly be wrong ! Just leave
+         * it as -1 which lets caller see that the VNC server isn't
+         * present yet. Subsquent dumps of the XML will eventually
+         * find the port in XenStore once VNC server has started
+         */
+        if (port == -1 && xendConfigVersion < 2)
+            port = 5900 + def->id;
+
+        if ((unused && STREQ(unused, "1")) || port == -1)
+            graphics->data.vnc.autoport = 1;
+        graphics->data.vnc.port = port;
+
+        if (listenAddr &&
+            !(graphics->data.vnc.listenAddr = strdup(listenAddr)))
+            goto no_memory;
+
+        if (vncPasswd &&
+            !(graphics->data.vnc.passwd = strdup(vncPasswd)))
+            goto no_memory;
+
+        if (keymap &&
+            !(graphics->data.vnc.keymap = strdup(keymap)))
+            goto no_memory;
+
+        def->graphics = graphics;
+    } else if ((tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux")) &&
+               tmp[0] == '1') {
+        /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
+        const char *display = sexpr_fmt_node(root, "domain/image/%s/display", hvm ? "hvm" : "linux");
+        const char *xauth = sexpr_fmt_node(root, "domain/image/%s/xauthority", hvm ? "hvm" : "linux");
+
+        if (VIR_ALLOC(graphics) < 0)
+            goto no_memory;
+
+        graphics->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
+        if (display &&
+            !(graphics->data.sdl.display = strdup(display)))
+            goto no_memory;
+        if (xauth &&
+            !(graphics->data.sdl.xauth = strdup(xauth)))
+            goto no_memory;
+
+        def->graphics = graphics;
+    }
+
+    return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+    virDomainGraphicsDefFree(graphics);
+    return -1;
+}
+
+
+static int
+xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
+                              virDomainDefPtr def,
+                              struct sexpr *root)
+{
+    virDomainGraphicsDefPtr graphics = NULL;
+    struct sexpr *cur, *node;
+    const char *tmp;
+
+    /* append network devices and framebuffer */
+    for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
+        node = cur->u.s.car;
+        if (sexpr_lookup(node, "device/vfb")) {
+            /* New style graphics config for PV guests in >= 3.0.4,
+             * or for HVM guests in >= 3.0.5 */
+            tmp = sexpr_node(node, "device/vfb/type");
+
+            if (VIR_ALLOC(graphics) < 0)
+                goto no_memory;
+
+            if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
+                virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown graphics type '%s'"), tmp);
+                goto error;
+            }
 
-    /* XXX should we force mode == r, if cdrom==1, or assume
-       xend has already done this ? */
-    if ((mode != NULL) && (STREQ (mode, "r")))
-        virBufferAddLit(buf, "      <readonly/>\n");
-    else if ((mode != NULL) && (STREQ (mode, "w!")))
-        virBufferAddLit(buf, "      <shareable/>\n");
-    virBufferAddLit(buf, "    </disk>\n");
+            if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+                const char *display = sexpr_node(node, "device/vfb/display");
+                const char *xauth = sexpr_node(node, "device/vfb/xauthority");
+                if (display &&
+                    !(graphics->data.sdl.display = strdup(display)))
+                    goto no_memory;
+                if (xauth &&
+                    !(graphics->data.sdl.xauth = strdup(xauth)))
+                    goto no_memory;
+            } else {
+                int port = xenStoreDomainGetVNCPort(conn, def->id);
+                const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten");
+                const char *vncPasswd = sexpr_node(node, "device/vfb/vncpasswd");;
+                const char *keymap = sexpr_node(node, "device/vfb/keymap");
+                const char *unused = sexpr_node(node, "device/vfb/vncunused");
+
+                if ((unused && STREQ(unused, "1")) || port == -1)
+                    graphics->data.vnc.autoport = 1;
+                graphics->data.vnc.port = port;
+
+                if (listenAddr &&
+                    !(graphics->data.vnc.listenAddr = strdup(listenAddr)))
+                    goto no_memory;
+
+                if (vncPasswd &&
+                    !(graphics->data.vnc.passwd = strdup(vncPasswd)))
+                    goto no_memory;
+
+                if (keymap &&
+                    !(graphics->data.vnc.keymap = strdup(keymap)))
+                    goto no_memory;
+            }
+
+            def->graphics = graphics;
+            break;
+        }
+    }
 
     return 0;
+
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+error:
+    virDomainGraphicsDefFree(graphics);
+    return -1;
 }
 
+
 /**
- * xend_parse_sexp_desc:
+ * xenDaemonParseSxpr:
  * @conn: the connection associated with the XML
  * @root: the root of the parsed S-Expression
  * @xendConfigVersion: version of xend
- * @flags: a combination of virDomainXMLFlags
  * @cpus: set of cpus the domain may be pinned to
  *
  * Parse the xend sexp description and turn it into the XML format similar
@@ -1765,25 +2213,19 @@ xend_parse_sexp_desc_blockdev (virConnectPtr conn ATTRIBUTE_UNUSED,
  * Returns the 0 terminated XML string or NULL in case of error.
  *         the caller must free() the returned value.
  */
-static char *
-xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
-                     int xendConfigVersion, int flags, const char *cpus)
+static virDomainDefPtr
+xenDaemonParseSxpr(virConnectPtr conn,
+                   struct sexpr *root,
+                   int xendConfigVersion,
+                   const char *cpus)
 {
-    struct sexpr *cur, *node;
     const char *tmp;
-    char *tty, *val;
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
-    int hvm = 0, bootloader = 0, vfb = 0;
-    int domid = -1;
-    int max_mem, cur_mem;
-    unsigned char uuid[VIR_UUID_BUFLEN];
-    char uuidstr[VIR_UUID_STRING_BUFLEN];
-    int vif_index = 0;
+    virDomainDefPtr def;
+    int hvm = 0;
+    char *tty = NULL;
 
-    if (root == NULL) {
-        /* ERROR */
-        return (NULL);
-    }
+    if (VIR_ALLOC(def) < 0)
+        goto no_memory;
 
     tmp = sexpr_node(root, "domain/domid");
     if (tmp == NULL && xendConfigVersion < 3) { /* Old XenD, domid was mandatory */
@@ -1791,353 +2233,273 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
                      _("domain information incomplete, missing id"));
         goto error;
     }
+    def->virtType = VIR_DOMAIN_VIRT_XEN;
     if (tmp)
-        domid = sexpr_int(root, "domain/domid");
+        def->id = sexpr_int(root, "domain/domid");
     else
-        domid = -1;
-    virBufferVSprintf(&buf, "<domain type='xen' id='%d'>\n", domid);
+        def->id = -1;
 
-    tmp = sexpr_node(root, "domain/name");
-    if (tmp == NULL) {
+    if (sexpr_node_copy(root, "domain/name", &def->name) < 0)
+        goto no_memory;
+    if (def->name == NULL) {
         virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                      _("domain information incomplete, missing name"));
         goto error;
     }
-    virBufferVSprintf(&buf, "  <name>%s</name>\n", tmp);
+
     tmp = sexpr_node(root, "domain/uuid");
     if (tmp == NULL) {
         virXendError(conn, VIR_ERR_INTERNAL_ERROR,
                      _("domain information incomplete, missing name"));
         goto error;
     }
-    virUUIDParse(tmp, uuid);
-    virUUIDFormat(uuid, uuidstr);
-    virBufferVSprintf(&buf, "  <uuid>%s</uuid>\n", uuidstr);
+    virUUIDParse(tmp, def->uuid);
 
     hvm = sexpr_lookup(root, "domain/image/hvm") ? 1 : 0;
     if (!hvm) {
-        tmp = sexpr_node(root, "domain/bootloader");
-        if (tmp != NULL) {
-            bootloader = 1;
-            virBufferVSprintf(&buf, "  <bootloader>%s</bootloader>\n", tmp);
-        } else if (sexpr_has(root, "domain/bootloader")) {
-            bootloader = 1;
-            virBufferAddLit(&buf, "  <bootloader/>\n");
-        }
-        tmp = sexpr_node(root, "domain/bootloader_args");
-        if (tmp != NULL && bootloader) {
-            /*
-             * Only insert bootloader_args if there is also a bootloader param
-             */
-            virBufferEscapeString(&buf, "  <bootloader_args>%s</bootloader_args>\n", tmp);
-        }
+        if (sexpr_node_copy(root, "domain/bootloader",
+                            &def->os.bootloader) < 0)
+            goto no_memory;
+
+        if (!def->os.bootloader &&
+            sexpr_has(root, "domain/bootloader") &&
+            (def->os.bootloader = strdup("")) == NULL)
+            goto no_memory;
+
+        if (def->os.bootloader &&
+            sexpr_node_copy(root, "domain/bootloader_args",
+                            &def->os.bootloaderArgs) < 0)
+            goto no_memory;
     }
 
-    if (domid != 0) {
+    if (!(def->os.type = strdup(hvm ? "hvm" : "linux")))
+        goto no_memory;
+
+    if (def->id != 0) {
         if (sexpr_lookup(root, "domain/image")) {
-            if (xend_parse_sexp_desc_os(conn, root, &buf, hvm, bootloader) < 0)
+            if (xenDaemonParseSxprOS(conn, root, def, hvm) < 0)
                 goto error;
         }
     }
 
-    max_mem = (int) (sexpr_u64(root, "domain/maxmem") << 10);
-    cur_mem = (int) (sexpr_u64(root, "domain/memory") << 10);
-    if (cur_mem > max_mem)
-        max_mem = cur_mem;
-    virBufferVSprintf(&buf, "  <memory>%d</memory>\n", max_mem);
-    if ((cur_mem >= MIN_XEN_GUEST_SIZE) && (cur_mem != max_mem))
-        virBufferVSprintf(&buf, "  <currentMemory>%d</currentMemory>\n",
-                          cur_mem);
+    def->maxmem = (unsigned long) (sexpr_u64(root, "domain/maxmem") << 10);
+    def->memory = (unsigned long) (sexpr_u64(root, "domain/memory") << 10);
+    if (def->memory > def->maxmem)
+        def->maxmem = def->memory;
 
-    virBufferAddLit(&buf, "  <vcpu");
     if (cpus != NULL) {
-        virBufferVSprintf(&buf, " cpuset='%s'", cpus);
-    }
-    virBufferVSprintf(&buf, ">%d</vcpu>\n",
-                      sexpr_int(root, "domain/vcpus"));
-    /* TODO if need to output the cpus values,
-     * - parse the cpus values if xend exports
-     * or
-     * - analyze the cpus values extracted by xenDaemonDomainGetVcpus
-     */
+        if (virDomainCpuSetParse(conn, &cpus,
+                                 0, def->cpumask,
+                                 def->cpumasklen) < 0)
+            goto error;
+    }
+    def->vcpus = sexpr_int(root, "domain/vcpus");
+
     tmp = sexpr_node(root, "domain/on_poweroff");
-    if (tmp != NULL)
-        virBufferVSprintf(&buf, "  <on_poweroff>%s</on_poweroff>\n", tmp);
+    if (tmp != NULL) {
+        if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("unknown lifecycle type %s"), tmp);
+            goto error;
+        }
+    } else
+        def->onPoweroff = VIR_DOMAIN_LIFECYCLE_DESTROY;
+
     tmp = sexpr_node(root, "domain/on_reboot");
-    if (tmp != NULL)
-        virBufferVSprintf(&buf, "  <on_reboot>%s</on_reboot>\n", tmp);
+    if (tmp != NULL) {
+        if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("unknown lifecycle type %s"), tmp);
+            goto error;
+        }
+    } else
+        def->onReboot = VIR_DOMAIN_LIFECYCLE_RESTART;
+
     tmp = sexpr_node(root, "domain/on_crash");
-    if (tmp != NULL)
-        virBufferVSprintf(&buf, "  <on_crash>%s</on_crash>\n", tmp);
+    if (tmp != NULL) {
+        if ((def->onCrash = virDomainLifecycleTypeFromString(tmp)) < 0) {
+            virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+                         _("unknown lifecycle type %s"), tmp);
+            goto error;
+        }
+    } else
+        def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY;
 
-    if (hvm) {
-        int clockLocal;
 
-        virBufferAddLit(&buf, "  <features>\n");
+    if (hvm) {
         if (sexpr_int(root, "domain/image/hvm/acpi"))
-            virBufferAddLit(&buf, "    <acpi/>\n");
+            def->features |= (1 << VIR_DOMAIN_FEATURE_ACPI);
         if (sexpr_int(root, "domain/image/hvm/apic"))
-            virBufferAddLit(&buf, "    <apic/>\n");
+            def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
         if (sexpr_int(root, "domain/image/hvm/pae"))
-            virBufferAddLit(&buf, "    <pae/>\n");
-        virBufferAddLit(&buf, "  </features>\n");
+            def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
 
-        clockLocal = sexpr_int(root, "domain/image/hvm/localtime");
-        virBufferVSprintf(&buf, "  <clock offset='%s'/>\n", clockLocal ? "localtime" : "utc");
+        if (sexpr_int(root, "domain/image/hvm/localtime"))
+            def->localtime = 1;
     }
 
-    virBufferAddLit(&buf, "  <devices>\n");
-
-    if (hvm)
-        tmp = sexpr_node(root, "domain/image/hvm/device_model");
-    else
-        tmp = sexpr_node(root, "domain/image/linux/device_model");
-    if ((tmp != NULL) && (tmp[0] != 0))
-        virBufferVSprintf(&buf, "    <emulator>%s</emulator>\n", tmp);
+    if (sexpr_node_copy(root, hvm ?
+                        "domain/image/hvm/device_model" :
+                        "domain/image/linux/device_model",
+                        &def->emulator) < 0)
+        goto no_memory;
 
     /* append block devices */
-    if (xend_parse_sexp_blockdevs (conn, root, xendConfigVersion,
-                                   xend_parse_sexp_desc_blockdev, &buf) == -1)
+    if (xenDaemonParseSxprDisks(conn, def, root, hvm, xendConfigVersion) < 0)
         goto error;
 
-    /* append network devices and framebuffer */
-    for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
-        node = cur->u.s.car;
-        if (sexpr_lookup(node, "device/vif")) {
-            const char *tmp2, *model;
-            tmp2 = sexpr_node(node, "device/vif/script");
-            tmp = sexpr_node(node, "device/vif/bridge");
-            model = sexpr_node(node, "device/vif/model");
-            if ((tmp2 && strstr(tmp2, "bridge")) || tmp) {
-                virBufferAddLit(&buf, "    <interface type='bridge'>\n");
-                if (tmp != NULL)
-                    virBufferVSprintf(&buf, "      <source bridge='%s'/>\n",
-                                      tmp);
-            } else {
-                virBufferAddLit(&buf, "    <interface type='ethernet'>\n");
-            }
+    if (xenDaemonParseSxprNets(conn, def, root) < 0)
+        goto error;
 
-            tmp = sexpr_node(node, "device/vif/vifname");
-            if (tmp)
-                virBufferVSprintf(&buf, "      <target dev='%s'/>\n",
-                                  tmp);
-            else
-                virBufferVSprintf(&buf, "      <target dev='vif%d.%d'/>\n",
-                                  domid, vif_index);
-            tmp = sexpr_node(node, "device/vif/mac");
-            if (tmp)
-                virBufferVSprintf(&buf, "      <mac address='%s'/>\n",
-                                  tmp);
-            tmp = sexpr_node(node, "device/vif/ip");
-            if (tmp)
-                virBufferVSprintf(&buf, "      <ip address='%s'/>\n",
-                                  tmp);
-            if (tmp2)
-                virBufferVSprintf(&buf, "      <script path='%s'/>\n",
-                                  tmp2);
-
-            if (model)
-                virBufferVSprintf(&buf, "      <model type='%s'/>\n",
-                                  model);
-
-            virBufferAddLit(&buf, "    </interface>\n");
-            vif_index++;
-        } else if (sexpr_lookup(node, "device/vfb")) {
-            /* New style graphics config for PV guests in >= 3.0.4,
-             * or for HVM guests in >= 3.0.5 */
-            tmp = sexpr_node(node, "device/vfb/type");
+    /* New style graphics device config */
+    if (xenDaemonParseSxprGraphicsNew(conn, def, root) < 0)
+        goto error;
 
-            if (tmp && STREQ(tmp, "sdl")) {
-                vfb = 1;
-                virBufferVSprintf(&buf, "    <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
-                virBufferAddLit(&buf, "    <graphics type='sdl'/>\n");
-            } else if (tmp && STREQ(tmp, "vnc")) {
-                int port = xenStoreDomainGetVNCPort(conn, domid);
-                const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten");
-                const char *vncPasswd = NULL;
-                const char *keymap = sexpr_node(node, "device/vfb/keymap");
-                vfb = 1;
-                virBufferVSprintf(&buf, "    <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
-                virBufferVSprintf(&buf, "    <graphics type='vnc' port='%d'", port);
-                if (listenAddr)
-                    virBufferVSprintf(&buf, " listen='%s'", listenAddr);
-                if (flags & VIR_DOMAIN_XML_SECURE) {
-                    vncPasswd = sexpr_node(node, "device/vfb/vncpasswd");
-                    if (vncPasswd)
-                        virBufferVSprintf(&buf, " passwd='%s'", vncPasswd);
-                }
-                if (keymap)
-                    virBufferVSprintf(&buf, " keymap='%s'", keymap);
-                virBufferAddLit(&buf, "/>\n");
-            }
-        }
-    }
+    /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
+    if (!def->graphics &&
+        xenDaemonParseSxprGraphicsOld(conn, def, root, hvm, xendConfigVersion) < 0)
+        goto error;
 
-    if (hvm) {
-        tmp = sexpr_node(root, "domain/image/hvm/fda");
-        if ((tmp != NULL) && (tmp[0] != 0)) {
-            virBufferAddLit(&buf, "    <disk type='file' device='floppy'>\n");
-            virBufferVSprintf(&buf, "      <source file='%s'/>\n", tmp);
-            virBufferAddLit(&buf, "      <target dev='fda' bus='fdc'/>\n");
-            virBufferAddLit(&buf, "    </disk>\n");
-        }
-        tmp = sexpr_node(root, "domain/image/hvm/fdb");
+
+    /* Old style cdrom config from Xen <= 3.0.2 */
+    if (hvm &&
+        xendConfigVersion == 1) {
+        tmp = sexpr_node(root, "domain/image/hvm/cdrom");
         if ((tmp != NULL) && (tmp[0] != 0)) {
-            virBufferAddLit(&buf, "    <disk type='file' device='floppy'>\n");
-            virBufferVSprintf(&buf, "      <source file='%s'/>\n", tmp);
-            virBufferAddLit(&buf, "      <target dev='fdb' bus='fdc'/>\n");
-            virBufferAddLit(&buf, "    </disk>\n");
-        }
+            virDomainDiskDefPtr disk, prev;
+            if (VIR_ALLOC(disk) < 0)
+                goto no_memory;
+            if (!(disk->src = strdup(tmp))) {
+                VIR_FREE(disk);
+                goto no_memory;
+            }
+            disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
+            disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
+            if (!(disk->dst = strdup("hdc"))) {
+                VIR_FREE(disk);
+                goto no_memory;
+            }
+            if (!(disk->driverName = strdup("file"))) {
+                VIR_FREE(disk);
+                goto no_memory;
+            }
+            disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
+            disk->readonly = 1;
 
-        /* Old style cdrom config from Xen <= 3.0.2 */
-        if (xendConfigVersion == 1) {
-            tmp = sexpr_node(root, "domain/image/hvm/cdrom");
-            if ((tmp != NULL) && (tmp[0] != 0)) {
-                virBufferAddLit(&buf, "    <disk type='file' device='cdrom'>\n");
-                virBufferAddLit(&buf, "      <driver name='file'/>\n");
-                virBufferVSprintf(&buf, "      <source file='%s'/>\n", tmp);
-                virBufferAddLit(&buf, "      <target dev='hdc' bus='ide'/>\n");
-                virBufferAddLit(&buf, "      <readonly/>\n");
-                virBufferAddLit(&buf, "    </disk>\n");
+            prev = def->disks;
+            while (prev && prev->next) {
+                prev = prev->next;
             }
+            if (prev)
+                prev->next = disk;
+            else
+                def->disks = disk;
         }
     }
 
-    /* in case of HVM we have devices emulation */
+
+    /* Floppy disk config */
     if (hvm) {
-        for (cur = sexpr_lookup(root, "domain/image/hvm"); cur && cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
-            node = cur->u.s.car;
-            if (sexpr_lookup(node, "usbdevice")) {
-                tmp = sexpr_node(node, "usbdevice");
-                if (tmp && *tmp) {
-                    if (STREQ(tmp, "tablet"))
-                        virBufferAddLit(&buf, "    <input type='tablet' bus='usb'/>\n");
-                    else if (STREQ(tmp, "mouse"))
-                        virBufferAddLit(&buf, "    <input type='mouse' bus='usb'/>\n");
+        const char *const fds[] = { "fda", "fdb" };
+        int i;
+        for (i = 0 ; i < sizeof(fds)/sizeof(fds[0]) ; i++) {
+            tmp = sexpr_fmt_node(root, "domain/image/hvm/%s", fds[i]);
+            if ((tmp != NULL) && (tmp[0] != 0)) {
+                virDomainDiskDefPtr disk, prev;
+                if (VIR_ALLOC(disk) < 0)
+                    goto no_memory;
+                if (!(disk->src = strdup(tmp))) {
+                    VIR_FREE(disk);
+                    goto no_memory;
                 }
-            }
-        }
-    }
-
-    /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
-    if (!vfb) {
-        tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
-        if (tmp != NULL) {
-            if (tmp[0] == '1') {
-                int port = xenStoreDomainGetVNCPort(conn, domid);
-                const char *listenAddr = sexpr_fmt_node(root, "domain/image/%s/vnclisten", hvm ? "hvm" : "linux");
-                const char *vncPasswd = NULL;
-                const char *keymap = sexpr_fmt_node(root, "domain/image/%s/keymap", hvm ? "hvm" : "linux");
-                /* For Xen >= 3.0.3, don't generate a fixed port mapping
-                 * because it will almost certainly be wrong ! Just leave
-                 * it as -1 which lets caller see that the VNC server isn't
-                 * present yet. Subsquent dumps of the XML will eventually
-                 * find the port in XenStore once VNC server has started
-                 */
-                if (port == -1 && xendConfigVersion < 2)
-                    port = 5900 + domid;
-                virBufferVSprintf(&buf, "    <input type='mouse' bus='%s'/>\n", hvm ? "ps2" : "xen");
-                virBufferVSprintf(&buf, "    <graphics type='vnc' port='%d'", port);
-                if (listenAddr)
-                    virBufferVSprintf(&buf, " listen='%s'", listenAddr);
-                if (flags & VIR_DOMAIN_XML_SECURE) {
-                    vncPasswd = sexpr_fmt_node(root, "domain/image/%s/vncpasswd", hvm ? "hvm" : "linux");
-                    if (vncPasswd)
-                        virBufferVSprintf(&buf, " passwd='%s'", vncPasswd);
+                disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
+                disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
+                if (!(disk->dst = strdup(fds[i]))) {
+                    VIR_FREE(disk);
+                    goto no_memory;
                 }
-                if (keymap)
-                    virBufferVSprintf(&buf, " keymap='%s'", keymap);
-                virBufferAddLit(&buf, "/>\n");
-            }
-        }
+                if (!(disk->driverName = strdup("file"))) {
+                    VIR_FREE(disk);
+                    goto no_memory;
+                }
+                disk->bus = VIR_DOMAIN_DISK_BUS_FDC;
 
-        /* Graphics device (HVM, or old (pre-3.0.4) style PV sdl config) */
-        tmp = sexpr_fmt_node(root, "domain/image/%s/sdl", hvm ? "hvm" : "linux");
-        if (tmp != NULL) {
-            if (tmp[0] == '1') {
-                virBufferVSprintf(&buf, "    <input type='mouse' bus='%s'/>\n", hvm ? "ps2" : "xen");
-                virBufferAddLit(&buf, "    <graphics type='sdl'/>\n");
+                prev = def->disks;
+                while (prev && prev->next) {
+                    prev = prev->next;
+                }
+                if (prev)
+                    prev->next = disk;
+                else
+                    def->disks = disk;
             }
         }
     }
 
-    tty = xenStoreDomainGetConsolePath(conn, domid);
+    /* in case of HVM we have USB device emulation */
+    if (hvm &&
+        xenDaemonParseSxprUSB(conn, def, root) < 0)
+        goto error;
+
+    /* Character device config */
+    tty = xenStoreDomainGetConsolePath(conn, def->id);
     if (hvm) {
         tmp = sexpr_node(root, "domain/image/hvm/serial");
         if (tmp && STRNEQ(tmp, "none")) {
-            if (xend_parse_sexp_desc_char(conn, &buf, "serial", 0, tmp, tty) < 0)
-                goto error;
-            /* Add back-compat <console/> tag for primary console */
-            if (xend_parse_sexp_desc_char(conn, &buf, "console", 0, tmp, tty) < 0)
+            if ((def->serials = xenDaemonParseSxprChar(conn, tmp, tty)) == NULL)
                 goto error;
         }
         tmp = sexpr_node(root, "domain/image/hvm/parallel");
         if (tmp && STRNEQ(tmp, "none")) {
             /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
-            if (xend_parse_sexp_desc_char(conn, &buf, "parallel", 0, tmp, NULL) < 0)
+            if ((def->parallels = xenDaemonParseSxprChar(conn, tmp, NULL)) == NULL)
                 goto error;
         }
     } else {
-        /* Paravirt always has a console */
-        if (tty) {
-            virBufferVSprintf(&buf, "    <console type='pty' tty='%s'>\n", tty);
-            virBufferVSprintf(&buf, "      <source path='%s'/>\n", tty);
-        } else {
-            virBufferAddLit(&buf, "    <console type='pty'>\n");
-        }
-        virBufferAddLit(&buf, "      <target port='0'/>\n");
-        virBufferAddLit(&buf, "    </console>\n");
+        /* Fake a paravirt console, since that's not in the sexpr */
+        if (!(def->console = xenDaemonParseSxprChar(conn, "pty", tty)))
+            goto error;
     }
     VIR_FREE(tty);
 
-    if (hvm) {
-        if (sexpr_node(root, "domain/image/hvm/soundhw")) {
-            char *soundxml;
-            tmp = sexpr_node(root, "domain/image/hvm/soundhw");
-            if (tmp && *tmp) {
-                if ((soundxml = sound_string_to_xml(tmp))) {
-                    virBufferVSprintf(&buf, "%s", soundxml);
-                    VIR_FREE(soundxml);
-                } else {
-                    virXendError(conn, VIR_ERR_INTERNAL_ERROR,
-                                 _("parsing soundhw string failed."));
-                    goto error;
-                }
-            }
-        }
-    }
-
-    virBufferAddLit(&buf, "  </devices>\n");
-    virBufferAddLit(&buf, "</domain>\n");
 
-    if (virBufferError(&buf)) {
-        virXendError(conn, VIR_ERR_NO_MEMORY, _("allocate buffer"));
-        return NULL;
+    /* Sound device config */
+    if (hvm &&
+        (tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL &&
+        *tmp) {
+        if (xenDaemonParseSxprSound(conn, def, tmp) < 0)
+            goto error;
     }
 
-    return virBufferContentAndReset(&buf);
+    return def;
 
-  error:
-    val = virBufferContentAndReset(&buf);
-    VIR_FREE(val);
-    return (NULL);
+no_memory:
+    virXendError(conn, VIR_ERR_NO_MEMORY, NULL);
+error:
+    VIR_FREE(tty);
+    virDomainDefFree(def);
+    return NULL;
 }
 
-char *
-xend_parse_domain_sexp(virConnectPtr conn, char *sexpr, int xendConfigVersion) {
-  struct sexpr *root = string2sexpr(sexpr);
-  char *data;
+virDomainDefPtr
+xenDaemonParseSxprString(virConnectPtr conn,
+                         const char *sexpr,
+                         int xendConfigVersion)
+{
+    struct sexpr *root = string2sexpr(sexpr);
+    virDomainDefPtr def;
 
-  if (!root)
-      return NULL;
+    if (!root)
+        return NULL;
 
-  data = xend_parse_sexp_desc(conn, root, xendConfigVersion, 0, NULL);
+    def = xenDaemonParseSxpr(conn, root, xendConfigVersion, NULL);
 
-  sexpr_free(root);
+    sexpr_free(root);
 
-  return data;
+    return def;
 }
 
+
 /**
  * sexpr_to_xend_domain_info:
  * @root: an S-Expression describing a domain
@@ -2864,6 +3226,7 @@ xenDaemonDomainDumpXMLByID(virConnectPtr conn, int domid, int flags,
     char *ret = NULL;
     struct sexpr *root;
     xenUnifiedPrivatePtr priv;
+    virDomainDefPtr def;
 
     root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
     if (root == NULL) {
@@ -2875,9 +3238,15 @@ xenDaemonDomainDumpXMLByID(virConnectPtr conn, int domid, int flags,
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
 
-    ret = xend_parse_sexp_desc(conn, root, priv->xendConfigVersion,
-                               flags, cpus);
+    if (!(def = xenDaemonParseSxpr(conn, root, priv->xendConfigVersion,
+                                   cpus)))
+        goto cleanup;
+
+    ret = virDomainDefFormat(conn, def, flags);
+
+cleanup:
     sexpr_free(root);
+    virDomainDefFree(def);
 
     return (ret);
 }
@@ -2889,6 +3258,7 @@ xenDaemonDomainDumpXMLByName(virConnectPtr conn, const char *name, int flags,
     char *ret = NULL;
     struct sexpr *root;
     xenUnifiedPrivatePtr priv;
+    virDomainDefPtr def;
 
     root = sexpr_get(conn, "/xend/domain/%s?detail=1", name);
     if (root == NULL) {
@@ -2900,9 +3270,15 @@ xenDaemonDomainDumpXMLByName(virConnectPtr conn, const char *name, int flags,
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
 
-    ret = xend_parse_sexp_desc(conn, root, priv->xendConfigVersion,
-                               flags, cpus);
+    if (!(def = xenDaemonParseSxpr(conn, root, priv->xendConfigVersion,
+                                   cpus)))
+        goto cleanup;
+
+    ret = virDomainDefFormat(conn, def, flags);
+
+cleanup:
     sexpr_free(root);
+    virDomainDefFree(def);
 
     return (ret);
 }
@@ -4339,29 +4715,6 @@ error:
     return (ret);
 }
 
-struct check_path_data {
-    const char *path;
-    int ok;
-};
-
-static int
-check_path (virConnectPtr conn ATTRIBUTE_UNUSED, void *vp,
-            int isBlock ATTRIBUTE_UNUSED,
-            int cdrom, int isNoSrcCdrom,
-            int hvm ATTRIBUTE_UNUSED,
-            const char *drvName ATTRIBUTE_UNUSED,
-            const char *drvType ATTRIBUTE_UNUSED,
-            const char *src, const char *dst ATTRIBUTE_UNUSED,
-            const char *mode ATTRIBUTE_UNUSED)
-{
-    struct check_path_data *data = (struct check_path_data *) vp;
-
-    if (!isNoSrcCdrom && !cdrom && src && STREQ (src, data->path))
-        data->ok = 1;
-
-    return 0;
-}
-
 /**
  * xenDaemonDomainBlockPeek:
  * @dom: domain object
@@ -4378,9 +4731,11 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
                           void *buffer)
 {
     xenUnifiedPrivatePtr priv;
-    struct sexpr *root;
-    struct check_path_data data;
-    int fd, ret = -1;
+    struct sexpr *root = NULL;
+    int fd = -1, ret = -1;
+    int found = 0;
+    virDomainDefPtr def;
+    virDomainDiskDefPtr disk;
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
 
@@ -4406,18 +4761,22 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
         return -1;
     }
 
-    data.path = path;
-    data.ok = 0;
-
-    if (xend_parse_sexp_blockdevs (domain->conn, root,
-                                   priv->xendConfigVersion,
-                                   check_path, &data) == -1)
-        return -1;
+    if (!(def = xenDaemonParseSxpr(domain->conn, root, priv->xendConfigVersion, NULL)))
+        goto cleanup;
 
-    if (!data.ok) {
+    disk = def->disks;
+    while (disk) {
+        if (disk->src &&
+            STREQ(disk->src, path)) {
+            found = 1;
+            break;
+        }
+        disk = disk->next;
+    }
+    if (!found) {
         virXendError (domain->conn, VIR_ERR_INVALID_ARG,
                       _("%s: invalid path"), path);
-        return -1;
+        goto cleanup;
     }
 
     /* The path is correct, now try to open it and get its size. */
@@ -4426,7 +4785,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
         virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR,
                       _("failed to open for reading: %s: %s"),
                       path, strerror (errno));
-        goto done;
+        goto cleanup;
     }
 
     /* Seek and read. */
@@ -4438,12 +4797,14 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
         virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR,
                       _("failed to lseek or read from file: %s: %s"),
                       path, strerror (errno));
-        goto done;
+        goto cleanup;
     }
 
     ret = 0;
done:
cleanup:
     if (fd >= 0) close (fd);
+    sexpr_free(root);
+    virDomainDefFree(def);
     return ret;
 }
 
index 30669abe677ba58a154c4a57bfaad1c3a226bce2..2e86aebedd158ece7c66bee94ea3c2f67886d860 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "libvirt/libvirt.h"
 #include "capabilities.h"
+#include "domain_conf.h"
 #include "buf.h"
 
 #ifdef __cplusplus
@@ -100,7 +101,10 @@ char *xenDaemonDomainDumpXMLByName(virConnectPtr xend,
                                   const char *value,
                                   const char *tty);
 
-  char *xend_parse_domain_sexp(virConnectPtr conn,  char *root, int xendConfigVersion);
+virDomainDefPtr
+xenDaemonParseSxprString(virConnectPtr conn,
+                         const char *sexpr,
+                         int xendConfigVersion);
 
   int is_sound_model_valid(const char *model);
   int is_sound_model_conflict(const char *model, const char *soundstr);
index 59bd3d4a851f8dd0f139ee90be4f4c50b4f93fd4..accf3dd960fbc5e2e48ec59375ae5b386511b67a 100644 (file)
@@ -1,6 +1,9 @@
 <domain type='xen' id='5'>
   <name>rhel5</name>
   <uuid>4f77abd2-3019-58e8-3bab-6fbf2118f880</uuid>
+  <memory>394240</memory>
+  <currentMemory>179200</currentMemory>
+  <vcpu>1</vcpu>
   <bootloader>/usr/bin/pygrub</bootloader>
   <os>
     <type>linux</type>
@@ -8,9 +11,7 @@
     <initrd>/var/lib/xen/initrd.gULTf1</initrd>
     <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
   </os>
-  <memory>394240</memory>
-  <currentMemory>179200</currentMemory>
-  <vcpu>1</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
       <target dev='xvda' bus='xen'/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:16:3e:1d:06:15'/>
       <source bridge='xenbr0'/>
       <target dev='vif5.0'/>
-      <mac address='00:16:3e:1d:06:15'/>
-      <script path='vif-bridge'/>
     </interface>
-    <input type='mouse' bus='xen'/>
-    <graphics type='vnc' port='-1'/>
     <console type='pty'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
   </devices>
 </domain>
index ff4e36537a4ad0da8585829ed3ed7fe26d5566a6..5316c554261ca412a554fbf2b5ee018a65d04b61 100644 (file)
@@ -1,10 +1,14 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>49a0c6ff-c066-5392-6498-3632d093c2e7</uuid>
-  <bootloader>/usr/bin/pygrub</bootloader>
   <memory>524288</memory>
   <currentMemory>393216</currentMemory>
   <vcpu>1</vcpu>
+  <bootloader>/usr/bin/pygrub</bootloader>
+  <os>
+    <type>linux</type>
+  </os>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
       <shareable/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:16:3e:23:9e:eb'/>
       <source bridge='xenbr0'/>
       <target dev='vif6.0'/>
-      <mac address='00:16:3e:23:9e:eb'/>
-      <script path='vif-bridge'/>
     </interface>
     <console type='pty'>
       <target port='0'/>
index c3c96748efd8d80e2519cfcf5a62757d06788c22..9eb116c9e7d04bf0f6d758e55153a251eec048e7 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index 8aa9162bcb333be339f3daf3ae7eacd470b2db89..4c56a72eb55974a66fed95d067b721577ffdffe8 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index 37fd40dc1f504b93591c3567ee01a489ab3c0542..4c8273f0fff14fbea39bfe707f34eb4503fd0028 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index 24011bb3deaee9c8ecd83f74cd5dfb1f53fc8f38..10cbc2d68ae02095eb8dc4d894c2eed5633a930f 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index def88b4ed6cde41a7206b8f010ef3aae88177a40..2809867613ec89889c72f4f0eb34bc771ce58858 100644 (file)
@@ -1,6 +1,9 @@
 <domain type='xen' id='15'>
   <name>fvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
-  <features>
-  </features>
-  <clock offset='utc'/>
   <devices>
     <disk type='file' device='disk'>
       <driver name='file'/>
index 680ff1c436cb08405243525e0783a19f05279407..f4836fb93e60a1404cf9ea3d0f42e20539538cda 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>s10u4</name>
   <uuid>fde0533d-d043-88c6-dfba-4822fa32f309</uuid>
+  <memory>1048576</memory>
+  <currentMemory>1048576</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>1048576</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <pae/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <interface type='ethernet'>
index e14dec2774ce85d481ab0ac27da46a8218489536..9ddc79b2fcedd6e5b621902881b6389185480cea 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='localtime'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
   </devices>
 </domain>
index 0a3032c12b977516882787faf10057545935f899..67bf3e73a1b81c5f5eefd24e174ba406f5b83372 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <parallel type='tcp'>
       <source mode='connect' host='localhost' service='9999'/>
       <protocol type='raw'/>
       <target port='0'/>
     </parallel>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 25e013f720c07e1f304fe2e220b6b66d9077bec4..a44dff4f2a438f7ef7b22ee4ac6a97822fec0af4 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='file'>
       <source path='/tmp/serial.log'/>
       <target port='0'/>
@@ -44,5 +42,7 @@
       <source path='/tmp/serial.log'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index c0b6e849a39c12283b85bbb9d488fbf7fac8dc29..5e2d446b5365f0017ddbdff8640b79c03948a2ac 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='null'>
       <target port='0'/>
     </serial>
     <console type='null'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index e36fe7d73dbacdd26b4e665182d5e91019e036d6..568d0b62c4d06597a4a583db6fe826c2db1f6da0 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='pipe'>
       <source path='/tmp/serial.pipe'/>
       <target port='0'/>
@@ -44,5 +42,7 @@
       <source path='/tmp/serial.pipe'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 2c1cf265eed341f52f7f8f11a0550dc598b69939..419f6462df38891d467e76e16d18ddd48d6033aa 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='pty'>
       <target port='0'/>
     </serial>
     <console type='pty'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 03123830dbd43f69e63050bff0a2c407d52f1a0e..b134c3c653065ceb4114bb7aa3bf9d5d16dc94fe 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='stdio'>
       <target port='0'/>
     </serial>
     <console type='stdio'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 2f3d1c546f1f412fb57ad510d47ff951d80298e3..8b10cd450380a5f675ba15a53bb1e7880cce34a8 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='tcp'>
       <source mode='bind' host='localhost' service='9999'/>
       <protocol type='telnet'/>
@@ -46,5 +44,7 @@
       <protocol type='telnet'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index b9c8cde6058c3701aa64cfebfcd06f4ba59965b6..5af249ef06715c76153e1ea2ceaa5e2e6d5edc86 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='tcp'>
       <source mode='bind' host='localhost' service='9999'/>
       <protocol type='raw'/>
@@ -46,5 +44,7 @@
       <protocol type='raw'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 7bed2749558ea53288b4dfcd36ebc95b54596173..f868eae0484cee9aafcc9e35832b28a34e755d53 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='udp'>
-      <source mode='connect' host='localhost' service='9998'/>
       <source mode='bind' host='localhost' service='9999'/>
+      <source mode='connect' host='localhost' service='9998'/>
       <target port='0'/>
     </serial>
     <console type='udp'>
-      <source mode='connect' host='localhost' service='9998'/>
       <source mode='bind' host='localhost' service='9999'/>
+      <source mode='connect' host='localhost' service='9998'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index b3f1fc68c73791aefba2fdcdf1ba82bd2df2d577..38e8069eda765b6af40a925f65a73a3a3b5163f2 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='1'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif1.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5901'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif1.0'/>
+    </interface>
     <serial type='unix'>
       <source mode='bind' path='/tmp/serial.sock'/>
       <target port='0'/>
@@ -44,5 +42,7 @@
       <source mode='bind' path='/tmp/serial.sock'/>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='5901' autoport='no'/>
   </devices>
 </domain>
index 415fb7b0e8dff7caa6d8a2a3b4db8f134d7264b8..08ef5652b42849d010e8be1bcad99594286e4027 100644 (file)
@@ -1 +1 @@
-(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)(soundhw 'idontexit,es1370,all')))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
+(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)(soundhw 'all')))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
index 66bd42c085d62206cfb63c0ac6a6441b74974e0c..487e32562fe3a3723c76fd4ed026c43d0f99d710 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
     <sound model='sb16'/>
     <sound model='es1370'/>
+    <sound model='pcspk'/>
   </devices>
 </domain>
index a57d949ed1f184eb739d34b937a9411db01bb89c..79115d033e1c67f8f4d33c9c219bc9f5fdb6a687 100644 (file)
@@ -1 +1 @@
-(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)(soundhw 'sb16,es1370,idontexist,es1370more')))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
+(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)(soundhw 'sb16,es1370')))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
index 66bd42c085d62206cfb63c0ac6a6441b74974e0c..6a4e9beb580f925166c10be409e60baa8e7f5ac2 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
     <sound model='sb16'/>
     <sound model='es1370'/>
   </devices>
index 63f6050cd64a98193d59778738dcf5bc89ac90be..9a02c2ed37a31dfd08ed93c64742da268021878d 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='usb'/>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
   </devices>
 </domain>
index 228510a8ae42c36eda069c053473d2a84de94d9d..b09d4176f1b7b02a749e7996bd1ea57db1f6f083 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='tablet' bus='usb'/>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
   </devices>
 </domain>
index 77b75809fd4d7a1ee0e22cf3f4715bf31d8bab46..d529a9d7ab512f0b1d244e458b232a550b5fc67e 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
   </devices>
 </domain>
index 2588da01eeb1489881935bf75b81e24cfaecff15..144a57a8335f0f03c58f361aee7b98bfdbca7d6b 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='cdrom'>
       <target dev='hda' bus='ide'/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
       <source bridge='xenbr0'/>
       <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
     </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='-1' keymap='ja'/>
+    <graphics type='vnc' port='-1' autoport='yes' keymap='ja'/>
   </devices>
 </domain>
index 77b75809fd4d7a1ee0e22cf3f4715bf31d8bab46..d529a9d7ab512f0b1d244e458b232a550b5fc67e 100644 (file)
@@ -1,20 +1,21 @@
 <domain type='xen' id='3'>
   <name>fvtest</name>
   <uuid>b5d70dd2-75cd-aca5-1776-9660b059d8bc</uuid>
+  <memory>409600</memory>
+  <currentMemory>409600</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>409600</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
   <features>
     <acpi/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
   <devices>
     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
     <disk type='file' device='disk'>
       <source file='/root/foo.img'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <target dev='vif3.0'/>
-      <mac address='00:16:3e:1b:b1:47'/>
-      <script path='vif-bridge'/>
-    </interface>
     <disk type='file' device='cdrom'>
       <driver name='file'/>
       <source file='/root/boot.iso'/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3e:1b:b1:47'/>
+      <source bridge='xenbr0'/>
+      <target dev='vif3.0'/>
+    </interface>
     <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='5903' keymap='ja'/>
+    <graphics type='vnc' port='5903' autoport='no' keymap='ja'/>
   </devices>
 </domain>
index d6526439d067682d246afe7a3906becb816516d0..0a5bf5eead96f67cbd26bc1c41a7217f75c3de38 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
       <target dev='xvda' bus='xen'/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:11:22:33:44:55'/>
       <source bridge='xenbr2'/>
       <target dev='vif6.0'/>
-      <mac address='00:11:22:33:44:55'/>
-      <script path='vif-bridge'/>
     </interface>
     <console type='pty'>
       <target port='0'/>
index 56061b055706cfae923182ad5733e747601bc0f6..cadd0d98d03e41350ac595d66eb6ec643f3b618c 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
       <target dev='xvda' bus='xen'/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:11:22:33:44:55'/>
       <source bridge='xenbr2'/>
       <target dev='vif6.0'/>
-      <mac address='00:11:22:33:44:55'/>
-      <script path='vif-bridge'/>
       <model type='e1000'/>
     </interface>
     <console type='pty'>
index b7a03810d45d8a287e5d6cb3227b3ee631e2e08f..07a08dbe609b76c14412ae7dbed918bf743cb520 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
       <target dev='xvda' bus='xen'/>
     </disk>
     <interface type='ethernet'>
-      <target dev='vif6.0'/>
       <mac address='00:11:22:33:44:55'/>
       <ip address='172.14.5.6'/>
       <script path='vif-routed'/>
+      <target dev='vif6.0'/>
     </interface>
     <console type='pty'>
       <target port='0'/>
index 946a8d218c1e7ae8226bb85a08934a0b1a5766e1..db34474f6ce1a3091ce90eba105df32ebff60cd3 100644 (file)
@@ -1,23 +1,23 @@
 <domain type='xen' id='6'>
   <name>test</name>
   <uuid>cc2315e7-d26a-307a-438c-6d188ec4c09c</uuid>
+  <memory>391168</memory>
+  <currentMemory>358400</currentMemory>
+  <vcpu>1</vcpu>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev='hd'/>
   </os>
-  <memory>391168</memory>
-  <currentMemory>358400</currentMemory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>destroy</on_reboot>
-  <on_crash>destroy</on_crash>
   <features>
     <acpi/>
     <apic/>
     <pae/>
   </features>
   <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <disk type='block' device='disk'>
       <source dev='/dev/sda8'/>
       <target dev='hda' bus='ide'/>
     </disk>
-    <disk device='cdrom'>
+    <disk type='file' device='cdrom'>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
     <interface type='bridge'>
+      <mac address='00:16:3e:0a:7b:39'/>
       <source bridge='xenbr0'/>
       <target dev='vif6.0'/>
-      <mac address='00:16:3e:0a:7b:39'/>
     </interface>
-    <input type='mouse' bus='ps2'/>
-    <graphics type='vnc' port='-1'/>
     <serial type='pty'>
       <target port='0'/>
     </serial>
     <console type='pty'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
   </devices>
 </domain>
index a41e3188397656c75a86243f1b427641e4db0d8f..eddf32f86264de9d5615c2f0b9a59b7453b23d6d 100644 (file)
@@ -1,10 +1,15 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
-  <bootloader>/usr/bin/pypxeboot</bootloader>
-  <bootloader_args>mac=AA:00:86:e2:35:72</bootloader_args>
   <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
   <vcpu>2</vcpu>
+  <bootloader>/usr/bin/pypxeboot</bootloader>
+  <bootloader_args>mac=AA:00:86:e2:35:72</bootloader_args>
+  <os>
+    <type>linux</type>
+  </os>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index 311630ca7edd6140e2f59834da5edcb6075d5327..9a0ad1f4434c0a49c4ce9b2f102bb296c108a5ee 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
       <source file='/root/some.img'/>
       <target dev='xvda' bus='xen'/>
     </disk>
-    <input type='mouse' bus='xen'/>
-    <graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/>
     <console type='pty'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='ja'/>
   </devices>
 </domain>
index 311630ca7edd6140e2f59834da5edcb6075d5327..9a0ad1f4434c0a49c4ce9b2f102bb296c108a5ee 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
       <source file='/root/some.img'/>
       <target dev='xvda' bus='xen'/>
     </disk>
-    <input type='mouse' bus='xen'/>
-    <graphics type='vnc' port='-1' listen='0.0.0.0' keymap='ja'/>
     <console type='pty'>
       <target port='0'/>
     </console>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='ja'/>
   </devices>
 </domain>
index 24011bb3deaee9c8ecd83f74cd5dfb1f53fc8f38..10cbc2d68ae02095eb8dc4d894c2eed5633a930f 100644 (file)
@@ -1,14 +1,16 @@
 <domain type='xen' id='6'>
   <name>pvtest</name>
   <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <memory>430080</memory>
+  <currentMemory>430080</currentMemory>
+  <vcpu>2</vcpu>
   <os>
     <type>linux</type>
     <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
     <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
     <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
   </os>
-  <memory>430080</memory>
-  <vcpu>2</vcpu>
+  <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>destroy</on_reboot>
   <on_crash>destroy</on_crash>
index fd8f7c71e0ba5a937fec6e1f543d8f373005af76..27952f6ab37b693ea5a5b480369ad5b33bf090d5 100644 (file)
@@ -24,19 +24,19 @@ static int testCompareFiles(const char *xml, const char *sexpr,
   char *xmlPtr = &(xmlData[0]);
   char *sexprPtr = &(sexprData[0]);
   int ret = -1;
+  virDomainDefPtr def = NULL;
 
-  if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) {
-      printf("Missing %s\n", xml);
+  if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
       goto fail;
-  }
 
-  if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0) {
-      printf("Missing %s\n", sexpr);
+  if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
+      goto fail;
+
+  if (!(def = xenDaemonParseSxprString(NULL, sexprData, xendConfigVersion)))
       goto fail;
-  }
 
-  if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData, xendConfigVersion)))
-    goto fail;
+  if (!(gotxml = virDomainDefFormat(NULL, def, 0)))
+      goto fail;
 
   if (STRNEQ(xmlData, gotxml)) {
       virtTestDifference(stderr, xmlData, gotxml);
@@ -47,6 +47,7 @@ static int testCompareFiles(const char *xml, const char *sexpr,
 
  fail:
   free(gotxml);
+  virDomainDefFree(def);
 
   return ret;
 }
@@ -122,7 +123,7 @@ mymain(int argc, char **argv)
     DO_TEST("fv-utc", "fv-utc", 1);
     DO_TEST("fv-localtime", "fv-localtime", 1);
     DO_TEST("fv-usbmouse", "fv-usbmouse", 1);
-    DO_TEST("fv-usbmouse", "fv-usbmouse", 1);
+    DO_TEST("fv-usbtablet", "fv-usbtablet", 1);
     DO_TEST("fv-kernel", "fv-kernel", 1);
 
     DO_TEST("fv-serial-null", "fv-serial-null", 1);