[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] New style CDROM config in Xen 3.0.3



So in a recent change to xen-unstable.hg the way CDROM devices are configured
for HVM guests changed. They are now treated as regular IDE devices, and a
CDROM is signified by presence of ':cdrom' suffix on the device name

  http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00369.html

libvirt obviously needs to support both this new style config, and the old
(<= 3.0.2) style configs. Thus I requested addition of 'xend_config_format'
attribute in the /xend/node SEXPR data from XenD. Christian recently
committed this patch, so we can now support both CDROM style configs in
libvirt. I am attaching a patch to implement this support - basically it
touches xend_internal.c to fix XML->SEXPR conversion, and xml.c to fix
SEXPR->XML conversion. Then this is corresponding additions to the unit
tests to validate the new code, and also validate that I didn't break
existing code.

I am attaching the patches, but I don't intend to commit them to libvirt
just yet because I don't actually have the new 3.0.3 xend running on my
test systems fully yet. If anyone is using 3.0.3 any testing would be
appreciated, otherwise I aim to test this towards end of next week.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
? libvirt-0.1.4.tar.gz
? docs/APIchunk4.html
Index: .cvsignore
===================================================================
RCS file: /data/cvs/libvirt/.cvsignore,v
retrieving revision 1.2
diff -c -r1.2 .cvsignore
*** .cvsignore	5 Jul 2006 21:52:52 -0000	1.2
--- .cvsignore	25 Aug 2006 17:33:50 -0000
***************
*** 19,21 ****
--- 19,22 ----
  update.log
  libvirt.pc
  libvirt.spec
+ COPYING
\ No newline at end of file
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.40
diff -c -r1.40 configure.in
*** configure.in	24 Aug 2006 21:46:28 -0000	1.40
--- configure.in	25 Aug 2006 17:33:50 -0000
***************
*** 257,260 ****
--- 257,262 ----
  	  include/libvirt/Makefile include/libvirt/libvirt.h \
  	  python/Makefile python/tests/Makefile \
            tests/Makefile proxy/Makefile \
+           tests/xml2sexprdata/Makefile \
+           tests/sexpr2xmldata/Makefile \
            tests/virshdata/Makefile)
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.57
diff -c -r1.57 xend_internal.c
*** src/xend_internal.c	24 Aug 2006 15:05:19 -0000	1.57
--- src/xend_internal.c	25 Aug 2006 17:33:52 -0000
***************
*** 1250,1255 ****
--- 1250,1285 ----
      return node;
  }
  
+ static int
+ xend_get_config_version(virConnectPtr conn) {
+     int ret = -1;
+     struct sexpr *root;
+     const char *value;
+ 
+     if (!VIR_IS_CONNECT(conn)) {
+         virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+         return (-1);
+     }
+ 
+     root = sexpr_get(conn, "/xend/node/");
+     if (root == NULL)
+         return (-1);
+ 
+     value = sexpr_node(root, "node/xend_config_format");
+ 
+     if (value) {
+         return strtol(value, NULL, 10);
+     } else {
+         /* Xen prior to 3.0.3 did not have the xend_config_format
+ 	   field, and is implicitly version 1. */
+         return 1;
+     }
+ 
+     sexpr_free(root);
+     return (ret);
+ }
+ 
+ 
  #ifndef PROXY
  /**
   * xend_node_shutdown:
***************
*** 1423,1429 ****
   *         the caller must free() the returned value.
   */
  static char *
! xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root)
  {
      char *ret;
      struct sexpr *cur, *node;
--- 1453,1459 ----
   *         the caller must free() the returned value.
   */
  static char *
! xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersion)
  {
      char *ret;
      struct sexpr *cur, *node;
***************
*** 1517,1553 ****
              if (tmp == NULL)
                  continue;
              if (!memcmp(tmp, "file:", 5)) {
!                 tmp += 5;
!                 virBufferVSprintf(&buf, "    <disk type='file' device='disk'>\n");
!                 virBufferVSprintf(&buf, "      <source file='%s'/>\n",
!                                   tmp);
!                 tmp = sexpr_node(node, "device/vbd/dev");
!                 if (tmp == NULL) {
                      virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
                                   "domain information incomplete, vbd has no dev");
                      goto error;
                  }
!                 if (!strncmp(tmp, "ioemu:", 6)) 
!                     tmp += 6;
!                 virBufferVSprintf(&buf, "      <target dev='%s'/>\n", tmp);
                  tmp = sexpr_node(node, "device/vbd/mode");
                  if ((tmp != NULL) && (!strcmp(tmp, "r")))
                      virBufferVSprintf(&buf, "      <readonly/>\n");
                  virBufferAdd(&buf, "    </disk>\n", 12);
              } else if (!memcmp(tmp, "phy:", 4)) {
!                 tmp += 4;
!                 virBufferVSprintf(&buf, "    <disk type='block' device='disk'>\n");
!                 virBufferVSprintf(&buf, "      <source dev='%s'/>\n", tmp);
!                 tmp = sexpr_node(node, "device/vbd/dev");
!                 if (tmp == NULL) {
                      virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
                                   "domain information incomplete, vbd has no dev");
                      goto error;
                  }
!                 if (!strncmp(tmp, "ioemu:", 6)) 
!                     tmp += 6;
!                 virBufferVSprintf(&buf, "      <target dev='%s'/>\n", tmp);
                  tmp = sexpr_node(node, "device/vbd/mode");
                  if ((tmp != NULL) && (!strcmp(tmp, "r")))
                      virBufferVSprintf(&buf, "      <readonly/>\n");
                  virBufferAdd(&buf, "    </disk>\n", 12);
--- 1547,1608 ----
              if (tmp == NULL)
                  continue;
              if (!memcmp(tmp, "file:", 5)) {
!                 int cdrom = 0;
!                 const char *src = tmp+5;
!                 const char *dst = sexpr_node(node, "device/vbd/dev");
! 
!                 if (dst == NULL) {
                      virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
                                   "domain information incomplete, vbd has no dev");
                      goto error;
                  }
!                 if (!strncmp(dst, "ioemu:", 6)) 
!                     dst += 6;
!                 /* New style cdrom config from Xen >= 3.0.3 */
!                 if (xendConfigVersion > 1) {
!                     char *offset = rindex(dst, ':');
!                     if (offset && !strcmp(offset, ":cdrom")) {
! 		        offset[0] = '\0';
!                         cdrom = 1;
!                     }
!                 }
! 
!                 virBufferVSprintf(&buf, "    <disk type='file' device='%s'>\n", cdrom ? "cdrom" : "disk");
!                 virBufferVSprintf(&buf, "      <source file='%s'/>\n", src);
!                 virBufferVSprintf(&buf, "      <target dev='%s'/>\n", dst);
                  tmp = sexpr_node(node, "device/vbd/mode");
+                 /* XXX should we force mode == r, if cdrom==1, or assume
+                    xend has already done this ? */
                  if ((tmp != NULL) && (!strcmp(tmp, "r")))
                      virBufferVSprintf(&buf, "      <readonly/>\n");
                  virBufferAdd(&buf, "    </disk>\n", 12);
              } else if (!memcmp(tmp, "phy:", 4)) {
!                 int cdrom = 0;
!                 const char *src = tmp+4;
!                 const char *dst = sexpr_node(node, "device/vbd/dev");
! 
!                 if (dst == NULL) {
                      virXendError(NULL, VIR_ERR_INTERNAL_ERROR,
                                   "domain information incomplete, vbd has no dev");
                      goto error;
                  }
!                 if (!strncmp(dst, "ioemu:", 6)) 
!                     dst += 6;
!                 /* New style cdrom config from Xen >= 3.0.3 */
!                 if (xendConfigVersion > 1) {
!                     char *offset = rindex(dst, ':');
!                     if (offset && !strcmp(offset, ":cdrom")) {
! 		        offset[0] = '\0';
!                         cdrom = 1;
!                     }
!                 }
! 
!                 virBufferVSprintf(&buf, "    <disk type='block' device='%s'>\n", cdrom ? "cdrom" : "disk");
!                 virBufferVSprintf(&buf, "      <source dev='%s'/>\n", src);
!                 virBufferVSprintf(&buf, "      <target dev='%s'/>\n", dst);
                  tmp = sexpr_node(node, "device/vbd/mode");
+                 /* XXX should we force mode == r, if cdrom==1, or assume
+                    xend has already done this ? */
                  if ((tmp != NULL) && (!strcmp(tmp, "r")))
                      virBufferVSprintf(&buf, "      <readonly/>\n");
                  virBufferAdd(&buf, "    </disk>\n", 12);
***************
*** 1609,1622 ****
              virBufferAdd(&buf, "      <target dev='fdb'/>\n", 26);
              virBufferAdd(&buf, "    </disk>\n", 12);
          }
!         /* XXX new (3.0.3) Xend puts cdrom devs in usual (devices) block */
!         tmp = sexpr_node(root, "domain/image/hvm/cdrom");
!         if ((tmp != NULL) && (tmp[0] != 0)) {
!             virBufferAdd(&buf, "    <disk type='file' device='cdrom'>\n", 38);
!             virBufferVSprintf(&buf, "      <source file='%s'/>\n", tmp);
!             virBufferAdd(&buf, "      <target dev='hdc'/>\n", 26);
!             virBufferAdd(&buf, "      <readonly/>\n", 18);
!             virBufferAdd(&buf, "    </disk>\n", 12);
          }
          
          /* Graphics device */
--- 1664,1680 ----
              virBufferAdd(&buf, "      <target dev='fdb'/>\n", 26);
              virBufferAdd(&buf, "    </disk>\n", 12);
          }
! 
!         /* 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)) {
!                 virBufferAdd(&buf, "    <disk type='file' device='cdrom'>\n", 38);
!                 virBufferVSprintf(&buf, "      <source file='%s'/>\n", tmp);
!                 virBufferAdd(&buf, "      <target dev='hdc'/>\n", 26);
!                 virBufferAdd(&buf, "      <readonly/>\n", 18);
!                 virBufferAdd(&buf, "    </disk>\n", 12);
!             }
          }
          
          /* Graphics device */
***************
*** 1656,1669 ****
  }
  
  char *
! xend_parse_domain_sexp(virConnectPtr conn, char *sexpr) {
    struct sexpr *root = string2sexpr(sexpr);
    char *data;
  
    if (!root)
        return NULL;
  
!   data = xend_parse_sexp_desc(conn, root);
  
    sexpr_free(root);
  
--- 1714,1727 ----
  }
  
  char *
! xend_parse_domain_sexp(virConnectPtr conn, char *sexpr, int xendConfigVersion) {
    struct sexpr *root = string2sexpr(sexpr);
    char *data;
  
    if (!root)
        return NULL;
  
!   data = xend_parse_sexp_desc(conn, root, xendConfigVersion);
  
    sexpr_free(root);
  
***************
*** 2167,2178 ****
  {
      char *ret = NULL;
      struct sexpr *root;
  
      root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
      if (root == NULL)
          return (NULL);
  
!     ret = xend_parse_sexp_desc(conn, root);
      sexpr_free(root);
  
      return (ret);
--- 2225,2242 ----
  {
      char *ret = NULL;
      struct sexpr *root;
+     int xendConfigVersion;
  
      root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
      if (root == NULL)
          return (NULL);
  
!     if ((xendConfigVersion = xend_get_config_version(conn)) < 0) {
!         virXendError(conn, VIR_ERR_INTERNAL_ERROR, "cannot determine xend config version");
!         return (NULL);
!     }
! 
!     ret = xend_parse_sexp_desc(conn, root, xendConfigVersion);
      sexpr_free(root);
  
      return (ret);
***************
*** 2716,2721 ****
--- 2780,2786 ----
      char *sexpr;
      char *name = NULL;
      virDomainPtr dom;
+     int xendConfigVersion;
  
      if (!VIR_IS_CONNECT(conn)) {
          virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
***************
*** 2726,2732 ****
          return (NULL);
      }
  
!     sexpr = virDomainParseXMLDesc(xmlDesc, &name);
      if ((sexpr == NULL) || (name == NULL)) {
          if (sexpr != NULL)
              free(sexpr);
--- 2791,2802 ----
          return (NULL);
      }
  
!     if ((xendConfigVersion = xend_get_config_version(conn)) < 0) {
!         virXendError(conn, VIR_ERR_INTERNAL_ERROR, "cannot determine xend config version");
!         return (NULL);
!     }
! 
!     sexpr = virDomainParseXMLDesc(xmlDesc, &name, xendConfigVersion);
      if ((sexpr == NULL) || (name == NULL)) {
          if (sexpr != NULL)
              free(sexpr);
Index: src/xend_internal.h
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.h,v
retrieving revision 1.25
diff -c -r1.25 xend_internal.h
*** src/xend_internal.h	24 Aug 2006 15:05:19 -0000	1.25
--- src/xend_internal.h	25 Aug 2006 17:33:53 -0000
***************
*** 613,619 ****
   */
      int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
  
!   char *xend_parse_domain_sexp(virConnectPtr conn,  char *root);
  
  /* refactored ones */
  void xenDaemonRegister(void);
--- 613,619 ----
   */
      int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
  
!   char *xend_parse_domain_sexp(virConnectPtr conn,  char *root, int xendConfigVersion);
  
  /* refactored ones */
  void xenDaemonRegister(void);
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.36
diff -c -r1.36 xml.c
*** src/xml.c	18 Aug 2006 20:20:50 -0000	1.36
--- src/xml.c	25 Aug 2006 17:33:53 -0000
***************
*** 575,580 ****
--- 575,581 ----
   * @node: node containing HVM OS description
   * @buf: a buffer for the result S-Expr
   * @ctxt: a path context representing the XML description
+  * @xendConfigVersion: xend configuration file format
   *
   * Parse the OS part of the XML description for an HVM domain and add it to
   * the S-Expr in buf. This is a temporary interface as the S-Expr interface
***************
*** 584,590 ****
   * Returns 0 in case of success, -1 in case of error.
   */
  static int
! virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr ctxt)
  {
      xmlXPathObjectPtr obj = NULL;
      xmlNodePtr cur, txt;
--- 585,591 ----
   * Returns 0 in case of success, -1 in case of error.
   */
  static int
! virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr ctxt, int xendConfigVersion)
  {
      xmlXPathObjectPtr obj = NULL;
      xmlNodePtr cur, txt;
***************
*** 656,699 ****
         obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='floppy' and target/@dev='fda']/source", ctxt);
         if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
             (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!          cur = obj->nodesetval->nodeTab[0];
!          virBufferVSprintf(buf, "(fda '%s')",
!                            (const char *) xmlGetProp(cur, BAD_CAST "file"));
!          cur = NULL;
         }
         if (obj) {
!          xmlXPathFreeObject(obj);
!          obj = NULL;
!     }
  
         /* get the 2nd floppy device file */
         obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='floppy' and target/@dev='fdb']/source", ctxt);
         if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
             (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!          cur = obj->nodesetval->nodeTab[0];
!          virBufferVSprintf(buf, "(fdb '%s')",
!                            (const char *) xmlGetProp(cur, BAD_CAST "file"));
!          cur = NULL;
         }
         if (obj) {
!          xmlXPathFreeObject(obj);
!          obj = NULL;
         }
  
  
         /* get the cdrom device file */
!        /* XXX new (3.0.3) Xend puts cdrom devs in usual (devices) block */
!        obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='cdrom' and target/@dev='hdc']/source", ctxt);
!        if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
!            (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!          cur = obj->nodesetval->nodeTab[0];
!          virBufferVSprintf(buf, "(cdrom '%s')",
!                            (const char *) xmlGetProp(cur, BAD_CAST "file"));
!          cur = NULL;
!        }
!        if (obj) {
!          xmlXPathFreeObject(obj);
!          obj = NULL;
         }
  
         obj = xmlXPathEval(BAD_CAST "/domain/features/acpi", ctxt);
--- 657,702 ----
         obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='floppy' and target/@dev='fda']/source", ctxt);
         if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
             (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!            cur = obj->nodesetval->nodeTab[0];
!            virBufferVSprintf(buf, "(fda '%s')",
!                              (const char *) xmlGetProp(cur, BAD_CAST "file"));
!            cur = NULL;
         }
         if (obj) {
!            xmlXPathFreeObject(obj);
!            obj = NULL;
!        }
  
         /* get the 2nd floppy device file */
         obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='floppy' and target/@dev='fdb']/source", ctxt);
         if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
             (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!            cur = obj->nodesetval->nodeTab[0];
!            virBufferVSprintf(buf, "(fdb '%s')",
!                              (const char *) xmlGetProp(cur, BAD_CAST "file"));
!            cur = NULL;
         }
         if (obj) {
!            xmlXPathFreeObject(obj);
!            obj = NULL;
         }
  
  
         /* get the cdrom device file */
!        /* Only XenD <= 3.0.2 wants cdrom config here */
!        if (xendConfigVersion == 1) {
!            obj = xmlXPathEval(BAD_CAST "/domain/devices/disk[ device='cdrom' and target/@dev='hdc']/source", ctxt);
!            if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
!                (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) {
!                cur = obj->nodesetval->nodeTab[0];
!                virBufferVSprintf(buf, "(cdrom '%s')",
!                                  (const char *) xmlGetProp(cur, BAD_CAST "file"));
!                cur = NULL;
!            }
!            if (obj) {
!                xmlXPathFreeObject(obj);
!                obj = NULL;
!            }
         }
  
         obj = xmlXPathEval(BAD_CAST "/domain/features/acpi", ctxt);
***************
*** 848,853 ****
--- 851,857 ----
   * virDomainParseXMLDiskDesc:
   * @node: node containing disk description
   * @buf: a buffer for the result S-Expr
+  * @xendConfigVersion: xend configuration file format
   *
   * Parse the one disk in the XML description and add it to the S-Expr in buf
   * This is a temporary interface as the S-Expr interface
***************
*** 857,863 ****
   * Returns 0 in case of success, -1 in case of error.
   */
  static int
! virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm)
  {
      xmlNodePtr cur;
      xmlChar *type = NULL;
--- 861,867 ----
   * Returns 0 in case of success, -1 in case of error.
   */
  static int
! virDomainParseXMLDiskDesc(xmlNodePtr node, virBufferPtr buf, int hvm, int xendConfigVersion)
  {
      xmlNodePtr cur;
      xmlChar *type = NULL;
***************
*** 866,871 ****
--- 870,876 ----
      xmlChar *target = NULL;
      int ro = 0;
      int typ = 0;
+     int cdrom = 0;
  
      type = xmlGetProp(node, BAD_CAST "type");
      if (type != NULL) {
***************
*** 911,939 ****
          return (-1);
      }
  
!     /* Skip floppy/cdrom disk used as the boot device
!      * since that's incorporated into the HVM kernel
!      * (image (hvm..)) part of the sexpr, rather than
!      * the (devices...) bit. Odd Xend HVM config :-(
!      * XXX This will have to change in Xen 3.0.3
       */
!     if (hvm && device &&
!         (!strcmp((const char *)device, "floppy") ||
!          !strcmp((const char *)device, "cdrom"))) {
!       return 0;
      }
  
  
      virBufferAdd(buf, "(device ", 8);
      virBufferAdd(buf, "(vbd ", 5);
!     /* XXX ioemu prefix is going away in Xen 3.0.3 */
      if (hvm) {
          char *tmp = (char *)target;
          if (!strncmp((const char *) tmp, "ioemu:", 6))
              tmp += 6;
!         virBufferVSprintf(buf, "(dev 'ioemu:%s')", (const char *) tmp);
      } else
!     virBufferVSprintf(buf, "(dev '%s')", (const char *) target);
      if (typ == 0)
          virBufferVSprintf(buf, "(uname 'file:%s')", source);
      else if (typ == 1) {
--- 916,958 ----
          return (-1);
      }
  
!     /* Xend (all versions) put the floppy device config
!      * under the hvm (image (os)) block
       */
!     if (hvm && 
! 	device &&
!         !strcmp((const char *)device, "floppy")) {
!         return 0;
!     }
! 
!     /* Xend <= 3.0.2 doesn't include cdrom config here */
!     if (hvm && 
! 	device &&
! 	!strcmp((const char *)device, "cdrom")) {
!         if (xendConfigVersion == 1)
!             return 0;
!         else
!             cdrom = 1;
      }
  
  
      virBufferAdd(buf, "(device ", 8);
      virBufferAdd(buf, "(vbd ", 5);
! 
      if (hvm) {
          char *tmp = (char *)target;
+         /* Just in case user mistakenly still puts ioemu: in their XML */
          if (!strncmp((const char *) tmp, "ioemu:", 6))
              tmp += 6;
! 
!         /* Xend <= 3.0.2 wants a ioemu: prefix on devices for HVM */
!         if (xendConfigVersion == 1)
!             virBufferVSprintf(buf, "(dev 'ioemu:%s')", (const char *) tmp);
!         else /* But newer does not */
!             virBufferVSprintf(buf, "(dev '%s%s')", (const char *) tmp, cdrom ? ":cdrom" : "");
      } else
!         virBufferVSprintf(buf, "(dev '%s')", (const char *) target);
! 
      if (typ == 0)
          virBufferVSprintf(buf, "(uname 'file:%s')", source);
      else if (typ == 1) {
***************
*** 1032,1037 ****
--- 1051,1057 ----
  /**
   * virDomainParseXMLDesc:
   * @xmldesc: string with the XML description
+  * @xendConfigVersion: xend configuration file format
   *
   * Parse the XML description and turn it into the xend sexp needed to
   * create the comain. This is a temporary interface as the S-Expr interface
***************
*** 1042,1048 ****
   *         the caller must free() the returned value.
   */
  char *
! virDomainParseXMLDesc(const char *xmldesc, char **name)
  {
      xmlDocPtr xml = NULL;
      xmlNodePtr node;
--- 1062,1068 ----
   *         the caller must free() the returned value.
   */
  char *
! virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
  {
      xmlDocPtr xml = NULL;
      xmlNodePtr node;
***************
*** 1180,1186 ****
  	    res = virDomainParseXMLOSDescPV(obj->nodesetval->nodeTab[0], &buf);
  	} else {
  	    hvm = 1;
! 	    res = virDomainParseXMLOSDescHVM(obj->nodesetval->nodeTab[0], &buf, ctxt);
  	}
  
  	xmlXPathFreeObject(tmpobj);
--- 1200,1206 ----
  	    res = virDomainParseXMLOSDescPV(obj->nodesetval->nodeTab[0], &buf);
  	} else {
  	    hvm = 1;
! 	    res = virDomainParseXMLOSDescHVM(obj->nodesetval->nodeTab[0], &buf, ctxt, xendConfigVersion);
  	}
  
  	xmlXPathFreeObject(tmpobj);
***************
*** 1198,1204 ****
      if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
          (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
  	for (i = 0; i < obj->nodesetval->nodeNr; i++) {
!             res = virDomainParseXMLDiskDesc(obj->nodesetval->nodeTab[i], &buf, hvm);
  	    if (res != 0) {
  		goto error;
  	    }
--- 1218,1224 ----
      if ((obj != NULL) && (obj->type == XPATH_NODESET) &&
          (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) {
  	for (i = 0; i < obj->nodesetval->nodeNr; i++) {
! 	  res = virDomainParseXMLDiskDesc(obj->nodesetval->nodeTab[i], &buf, hvm, xendConfigVersion);
  	    if (res != 0) {
  		goto error;
  	    }
Index: src/xml.h
===================================================================
RCS file: /data/cvs/libvirt/src/xml.h,v
retrieving revision 1.8
diff -c -r1.8 xml.h
*** src/xml.h	16 Aug 2006 16:33:55 -0000	1.8
--- src/xml.h	25 Aug 2006 17:33:53 -0000
***************
*** 29,35 ****
  int virBufferAdd(virBufferPtr buf, const char *str, int len);
  int virBufferVSprintf(virBufferPtr buf, const char *format, ...);
  int virBufferStrcat(virBufferPtr buf, ...);
! char *virDomainParseXMLDesc(const char *xmldesc, char **name);
  unsigned char *virParseUUID(char **ptr, const char *uuid);
  
  #ifdef __cplusplus
--- 29,35 ----
  int virBufferAdd(virBufferPtr buf, const char *str, int len);
  int virBufferVSprintf(virBufferPtr buf, const char *format, ...);
  int virBufferStrcat(virBufferPtr buf, ...);
! char *virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion);
  unsigned char *virParseUUID(char **ptr, const char *uuid);
  
  #ifdef __cplusplus
Index: tests/.cvsignore
===================================================================
RCS file: /data/cvs/libvirt/tests/.cvsignore,v
retrieving revision 1.3
diff -c -r1.3 .cvsignore
*** tests/.cvsignore	24 Aug 2006 21:46:28 -0000	1.3
--- tests/.cvsignore	25 Aug 2006 17:33:53 -0000
***************
*** 3,8 ****
--- 3,12 ----
  .deps
  .libs
  xmlrpctest
+ <<<<<<< .cvsignore
+ xml2sexprtest
+ =======
  sexpr2xmltest
  xml2sexprtest
  virshtest
+ >>>>>>> 1.3
Index: tests/Makefile.am
===================================================================
RCS file: /data/cvs/libvirt/tests/Makefile.am,v
retrieving revision 1.5
diff -c -r1.5 Makefile.am
*** tests/Makefile.am	24 Aug 2006 21:46:28 -0000	1.5
--- tests/Makefile.am	25 Aug 2006 17:33:53 -0000
***************
*** 1,6 ****
  ## Process this file with automake to produce Makefile.in
  
! SUBDIRS = virshdata
  
  LIBVIRT = $(top_builddir)/src/.libs/libvirt.a
  
--- 1,6 ----
  ## Process this file with automake to produce Makefile.in
  
! SUBDIRS = virshdata xml2sexprdata sexpr2xmldata
  
  LIBVIRT = $(top_builddir)/src/.libs/libvirt.a
  
Index: tests/sexpr2xml-fv.sexpr
===================================================================
RCS file: tests/sexpr2xml-fv.sexpr
diff -N tests/sexpr2xml-fv.sexpr
*** tests/sexpr2xml-fv.sexpr	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 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)))(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))))
--- 0 ----
Index: tests/sexpr2xml-fv.xml
===================================================================
RCS file: tests/sexpr2xml-fv.xml
diff -N tests/sexpr2xml-fv.xml
*** tests/sexpr2xml-fv.xml	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,35 ****
- <domain type='xen' id='3'>
-   <name>fvtest</name>
-   <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
-   <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>
-   <devices>
-     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
-     <disk type='file' device='disk'>
-       <source file='/root/foo.img'/>
-       <target dev='hda'/>
-     </disk>
-     <interface type='bridge'>
-       <source bridge='xenbr0'/>
-       <mac address='00:16:3e:1b:b1:47'/>
-       <script path='vif-bridge'/>
-     </interface>
-     <disk type='file' device='cdrom'>
-       <source file='/root/boot.iso'/>
-       <target dev='hdc'/>
-       <readonly/>
-     </disk>
-     <graphics type='vnc' port='5903'/>
-   </devices>
- </domain>
--- 0 ----
Index: tests/sexpr2xml-pv.sexpr
===================================================================
RCS file: tests/sexpr2xml-pv.sexpr
diff -N tests/sexpr2xml-pv.sexpr
*** tests/sexpr2xml-pv.sexpr	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,2 ****
- (domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
- 
--- 0 ----
Index: tests/sexpr2xml-pv.xml
===================================================================
RCS file: tests/sexpr2xml-pv.xml
diff -N tests/sexpr2xml-pv.xml
*** tests/sexpr2xml-pv.xml	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,21 ****
- <domain type='xen' id='6'>
-   <name>pvtest</name>
-   <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
-   <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>
-   <on_poweroff>destroy</on_poweroff>
-   <on_reboot>destroy</on_reboot>
-   <on_crash>destroy</on_crash>
-   <devices>
-     <disk type='file' device='disk'>
-       <source file='/root/some.img'/>
-       <target dev='xvda'/>
-     </disk>
-   </devices>
- </domain>
--- 0 ----
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.1
diff -c -r1.1 sexpr2xmltest.c
*** tests/sexpr2xmltest.c	24 Aug 2006 15:05:19 -0000	1.1
--- tests/sexpr2xmltest.c	25 Aug 2006 17:33:53 -0000
***************
*** 11,17 ****
  
  #define MAX_FILE 4096
  
! static int testCompareFiles(const char *xml, const char *sexpr) {
    char xmlData[MAX_FILE];
    char sexprData[MAX_FILE];
    char *gotxml = NULL;
--- 11,17 ----
  
  #define MAX_FILE 4096
  
! static int testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion) {
    char xmlData[MAX_FILE];
    char sexprData[MAX_FILE];
    char *gotxml = NULL;
***************
*** 24,30 ****
    if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
      return -1;
  
!   if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData)))
      return -1;
  
    if (getenv("DEBUG_TESTS")) {
--- 24,30 ----
    if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
      return -1;
  
!   if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData, xendConfigVersion)))
      return -1;
  
    if (getenv("DEBUG_TESTS")) {
***************
*** 37,50 ****
    return 0;
  }
  
! static int testComparePV(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xml-pv.xml",
! 			  "sexpr2xml-pv.sexpr");
  }
  
! static int testCompareFV(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xml-fv.xml",
! 			  "sexpr2xml-fv.sexpr");
  }
  
  int
--- 37,64 ----
    return 0;
  }
  
! static int testComparePVversion1(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml",
! 			  "sexpr2xmldata/sexpr2xml-pv.sexpr",
! 			  1);
  }
  
! static int testCompareFVversion1(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xmldata/sexpr2xml-fv.xml",
! 			  "sexpr2xmldata/sexpr2xml-fv.sexpr",
! 			  1);
! }
! 
! static int testComparePVversion2(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xmldata/sexpr2xml-pv.xml",
! 			  "sexpr2xmldata/sexpr2xml-pv.sexpr",
! 			  2);
! }
! 
! static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-v2.xml",
! 			  "sexpr2xmldata/sexpr2xml-fv-v2.sexpr",
! 			  2);
  }
  
  int
***************
*** 59,70 ****
          exit(EXIT_FAILURE);
      }
      
!     if (virtTestRun("SEXPR-2-XML PV config", 
! 		    1, testComparePV, NULL) != 0)
          ret = -1;
  
!     if (virtTestRun("SEXPR-2-XML FV config", 
! 		    1, testCompareFV, NULL) != 0)
          ret = -1;
  
      exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
--- 73,92 ----
          exit(EXIT_FAILURE);
      }
      
!     if (virtTestRun("SEXPR-2-XML PV config (version 1)", 
! 		    1, testComparePVversion1, NULL) != 0)
!         ret = -1;
! 
!     if (virtTestRun("SEXPR-2-XML FV config (version 1)", 
! 		    1, testCompareFVversion1, NULL) != 0)
!         ret = -1;
! 
!     if (virtTestRun("SEXPR-2-XML PV config (version 2)", 
! 		    1, testComparePVversion2, NULL) != 0)
          ret = -1;
  
!     if (virtTestRun("SEXPR-2-XML FV config  (version 2)", 
! 		    1, testCompareFVversion2, NULL) != 0)
          ret = -1;
  
      exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
Index: tests/xml2sexpr-fv.sexpr
===================================================================
RCS file: tests/xml2sexpr-fv.sexpr
diff -N tests/xml2sexpr-fv.sexpr
*** tests/xml2sexpr-fv.sexpr	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1 ****
- (vm (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)))(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))))
\ No newline at end of file
--- 0 ----
Index: tests/xml2sexpr-fv.xml
===================================================================
RCS file: tests/xml2sexpr-fv.xml
diff -N tests/xml2sexpr-fv.xml
*** tests/xml2sexpr-fv.xml	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,36 ****
- <domain type='xen'>
-   <name>fvtest</name>
-   <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
-   <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>
-   <devices>
-     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
-     <interface type='bridge'>
-       <source bridge='xenbr0'/>
-       <mac address='00:16:3e:1b:b1:47'/>
-       <script path='vif-bridge'/>
-     </interface>
-     <disk type='file' device='cdrom'>
-       <source file='/root/boot.iso'/>
-       <target dev='hdc'/>
-       <readonly/>
-     </disk>
-     <disk type='file'>
-       <source file='/root/foo.img'/>
-       <target dev='ioemu:hda'/>
-     </disk>
-     <graphics type='vnc' port='5917'/>
-   </devices>
- </domain>
- 
--- 0 ----
Index: tests/xml2sexpr-pv.sexpr
===================================================================
RCS file: tests/xml2sexpr-pv.sexpr
diff -N tests/xml2sexpr-pv.sexpr
*** tests/xml2sexpr-pv.sexpr	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1 ****
- (vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
--- 0 ----
Index: tests/xml2sexpr-pv.xml
===================================================================
RCS file: tests/xml2sexpr-pv.xml
diff -N tests/xml2sexpr-pv.xml
*** tests/xml2sexpr-pv.xml	24 Aug 2006 15:05:19 -0000	1.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,23 ****
- <domain type='xen' id='15'>
-   <name>pvtest</name>
-   <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
-   <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>
-   <on_poweroff>destroy</on_poweroff>
-   <on_reboot>destroy</on_reboot>
-   <on_crash>destroy</on_crash>
-   <devices>
-     <disk type='file' device='disk'>
-       <source file='/root/some.img'/>
-       <target dev='xvda'/>
-     </disk>
-     <console tty='/dev/pts/4'/>
-   </devices>
- </domain>
- 
--- 0 ----
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.1
diff -c -r1.1 xml2sexprtest.c
*** tests/xml2sexprtest.c	24 Aug 2006 15:05:19 -0000	1.1
--- tests/xml2sexprtest.c	25 Aug 2006 17:33:53 -0000
***************
*** 10,16 ****
  
  #define MAX_FILE 4096
  
! static int testCompareFiles(const char *xml, const char *sexpr, const char *name) {
    char xmlData[MAX_FILE];
    char sexprData[MAX_FILE];
    char *gotname = NULL;
--- 10,16 ----
  
  #define MAX_FILE 4096
  
! static int testCompareFiles(const char *xml, const char *sexpr, const char *name, int xendConfigVersion) {
    char xmlData[MAX_FILE];
    char sexprData[MAX_FILE];
    char *gotname = NULL;
***************
*** 24,30 ****
    if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
      return -1;
  
!   if (!(gotsexpr = virDomainParseXMLDesc(xmlData, &gotname))) 
      return -1;
  
    if (getenv("DEBUG_TESTS")) {
--- 24,30 ----
    if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
      return -1;
  
!   if (!(gotsexpr = virDomainParseXMLDesc(xmlData, &gotname, xendConfigVersion))) 
      return -1;
  
    if (getenv("DEBUG_TESTS")) {
***************
*** 40,55 ****
    return 0;
  }
  
! static int testComparePV(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexpr-pv.xml",
! 			  "xml2sexpr-pv.sexpr",
! 			  "pvtest");
  }
  
! static int testCompareFV(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexpr-fv.xml",
! 			  "xml2sexpr-fv.sexpr",
! 			  "fvtest");
  }
  
  int
--- 40,71 ----
    return 0;
  }
  
! static int testComparePVversion1(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexprdata/xml2sexpr-pv.xml",
! 			  "xml2sexprdata/xml2sexpr-pv.sexpr",
! 			  "pvtest",
! 			  1);
  }
  
! static int testCompareFVversion1(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexprdata/xml2sexpr-fv.xml",
! 			  "xml2sexprdata/xml2sexpr-fv.sexpr",
! 			  "fvtest",
! 			  1);
! }
! 
! static int testComparePVversion2(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexprdata/xml2sexpr-pv.xml",
! 			  "xml2sexprdata/xml2sexpr-pv.sexpr",
! 			  "pvtest",
! 			  2);
! }
! 
! static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
!   return testCompareFiles("xml2sexprdata/xml2sexpr-fv.xml",
! 			  "xml2sexprdata/xml2sexpr-fv-v2.sexpr",
! 			  "fvtest",
! 			  2);
  }
  
  int
***************
*** 64,75 ****
          exit(EXIT_FAILURE);
      }
      
!     if (virtTestRun("XML-2-SEXPR PV config", 
! 		    1, testComparePV, NULL) != 0)
          ret = -1;
  
!     if (virtTestRun("XML-2-SEXPR FV config", 
! 		    1, testCompareFV, NULL) != 0)
          ret = -1;
  
      exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
--- 80,99 ----
          exit(EXIT_FAILURE);
      }
      
!     if (virtTestRun("XML-2-SEXPR PV config (format 1)", 
! 		    1, testComparePVversion1, NULL) != 0)
!         ret = -1;
! 
!     if (virtTestRun("XML-2-SEXPR FV config (format 1)", 
! 		    1, testCompareFVversion1, NULL) != 0)
!         ret = -1;
! 
!     if (virtTestRun("XML-2-SEXPR PV config (format 2)",
! 		    1, testComparePVversion2, NULL) != 0)
          ret = -1;
  
!     if (virtTestRun("XML-2-SEXPR FV config (format 2)", 
! 		    1, testCompareFVversion2, NULL) != 0)
          ret = -1;
  
      exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
Index: tests/sexpr2xmldata/.cvsignore
===================================================================
RCS file: tests/sexpr2xmldata/.cvsignore
diff -N tests/sexpr2xmldata/.cvsignore
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/.cvsignore	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,2 ----
+ Makefile
+ Makefile.in
Index: tests/sexpr2xmldata/Makefile.am
===================================================================
RCS file: tests/sexpr2xmldata/Makefile.am
diff -N tests/sexpr2xmldata/Makefile.am
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/Makefile.am	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,2 ----
+ 
+ EXTRA_DIST = $(wildcard *.xml) $(wildcard *.sexpr)
Index: tests/sexpr2xmldata/sexpr2xml-fv-v2.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-v2.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-fv-v2.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-fv-v2.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 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)(acpi 1)(vnc 1)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev '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: tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
diff -N tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-fv-v2.xml	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,35 ----
+ <domain type='xen' id='3'>
+   <name>fvtest</name>
+   <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+   <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>
+   <devices>
+     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+     <disk type='file' device='cdrom'>
+       <source file='/root/boot.iso'/>
+       <target dev='hdc'/>
+       <readonly/>
+     </disk>
+     <disk type='file' device='disk'>
+       <source file='/root/foo.img'/>
+       <target dev='hda'/>
+     </disk>
+     <interface type='bridge'>
+       <source bridge='xenbr0'/>
+       <mac address='00:16:3e:1b:b1:47'/>
+       <script path='vif-bridge'/>
+     </interface>
+     <graphics type='vnc' port='5903'/>
+   </devices>
+ </domain>
Index: tests/sexpr2xmldata/sexpr2xml-fv.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-fv.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-fv.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 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)))(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: tests/sexpr2xmldata/sexpr2xml-fv.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv.xml
diff -N tests/sexpr2xmldata/sexpr2xml-fv.xml
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-fv.xml	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,35 ----
+ <domain type='xen' id='3'>
+   <name>fvtest</name>
+   <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+   <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>
+   <devices>
+     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+     <disk type='file' device='disk'>
+       <source file='/root/foo.img'/>
+       <target dev='hda'/>
+     </disk>
+     <interface type='bridge'>
+       <source bridge='xenbr0'/>
+       <mac address='00:16:3e:1b:b1:47'/>
+       <script path='vif-bridge'/>
+     </interface>
+     <disk type='file' device='cdrom'>
+       <source file='/root/boot.iso'/>
+       <target dev='hdc'/>
+       <readonly/>
+     </disk>
+     <graphics type='vnc' port='5903'/>
+   </devices>
+ </domain>
Index: tests/sexpr2xmldata/sexpr2xml-pv.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-pv.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-pv.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,2 ----
+ (domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
+ 
Index: tests/sexpr2xmldata/sexpr2xml-pv.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-pv.xml
diff -N tests/sexpr2xmldata/sexpr2xml-pv.xml
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/sexpr2xmldata/sexpr2xml-pv.xml	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,21 ----
+ <domain type='xen' id='6'>
+   <name>pvtest</name>
+   <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+   <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>
+   <on_poweroff>destroy</on_poweroff>
+   <on_reboot>destroy</on_reboot>
+   <on_crash>destroy</on_crash>
+   <devices>
+     <disk type='file' device='disk'>
+       <source file='/root/some.img'/>
+       <target dev='xvda'/>
+     </disk>
+   </devices>
+ </domain>
Index: tests/xml2sexprdata/.cvsignore
===================================================================
RCS file: tests/xml2sexprdata/.cvsignore
diff -N tests/xml2sexprdata/.cvsignore
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/.cvsignore	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,2 ----
+ Makefile
+ Makefile.in
Index: tests/xml2sexprdata/Makefile.am
===================================================================
RCS file: tests/xml2sexprdata/Makefile.am
diff -N tests/xml2sexprdata/Makefile.am
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/Makefile.am	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,2 ----
+ 
+ EXTRA_DIST = $(wildcard *.xml) $(wildcard *.sexpr)
Index: tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
diff -N tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1 ----
+ (vm (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)(acpi 1)(vnc 1)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv.sexpr
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-fv.sexpr
diff -N tests/xml2sexprdata/xml2sexpr-fv.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/xml2sexpr-fv.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1 ----
+ (vm (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)))(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))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv.xml
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-fv.xml
diff -N tests/xml2sexprdata/xml2sexpr-fv.xml
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/xml2sexpr-fv.xml	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,36 ----
+ <domain type='xen'>
+   <name>fvtest</name>
+   <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
+   <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>
+   <devices>
+     <emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
+     <interface type='bridge'>
+       <source bridge='xenbr0'/>
+       <mac address='00:16:3e:1b:b1:47'/>
+       <script path='vif-bridge'/>
+     </interface>
+     <disk type='file' device='cdrom'>
+       <source file='/root/boot.iso'/>
+       <target dev='hdc'/>
+       <readonly/>
+     </disk>
+     <disk type='file'>
+       <source file='/root/foo.img'/>
+       <target dev='ioemu:hda'/>
+     </disk>
+     <graphics type='vnc' port='5917'/>
+   </devices>
+ </domain>
+ 
Index: tests/xml2sexprdata/xml2sexpr-pv.sexpr
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-pv.sexpr
diff -N tests/xml2sexprdata/xml2sexpr-pv.sexpr
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/xml2sexpr-pv.sexpr	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1 ----
+ (vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-pv.xml
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-pv.xml
diff -N tests/xml2sexprdata/xml2sexpr-pv.xml
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- tests/xml2sexprdata/xml2sexpr-pv.xml	25 Aug 2006 17:33:53 -0000
***************
*** 0 ****
--- 1,23 ----
+ <domain type='xen' id='15'>
+   <name>pvtest</name>
+   <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+   <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>
+   <on_poweroff>destroy</on_poweroff>
+   <on_reboot>destroy</on_reboot>
+   <on_crash>destroy</on_crash>
+   <devices>
+     <disk type='file' device='disk'>
+       <source file='/root/some.img'/>
+       <target dev='xvda'/>
+     </disk>
+     <console tty='/dev/pts/4'/>
+   </devices>
+ </domain>
+ 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]