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

Re: [libvirt] patch: allow disk cache mode to be specified in a domain's xml definition.



On Fri, Jan 30, 2009 at 12:07:31AM +0100, Jim Meyering wrote:

> Here's your rebased and adjusted patch:
> 
> 
> From ce4f15853e119d6d976a5d29917f62f577e8ec9e Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Thu, 29 Jan 2009 22:50:36 +0100
> Subject: [PATCH] allow disk cache mode to be specified in a domain's xml definition.
> 
> Daniel P. Berrange wrote:
> >
> > If you loook at src/qemu_conf.c, you'll find a nice method called
> > qemudExtractVersionInfo, which runs 'qemu -help' and checks for
> > certain interesting command line arguments :-)
> That problem does seem to be crying for some type
> of structured interface to avoid subtle breakage
> should someone modify the output of "--help".
> I'm sure I'm preaching to the choir here.
> 
> So it now adapts for the cases of old syntax and
> "writethrough" as well as new syntax and "on"
> since qemu will otherwise balk at those cache
> flag / version combinations.
> > One note about the enums - rather than adding old style CACHEON
> > CACHE_OFF options to the main enum in domain_conf, just create
> > a second enum in the qemu_conf.c file for recording the mapping
> > of virDomainDiskCache values to old style QEMU arguments values..
> As we are adapting in both directions I left the
> single enum representing the entire option list
> to simplify things. Updated patch is attached.
> ---
>  src/domain_conf.c |   34 ++++++++++++++++++++++++++--------
>  src/domain_conf.h |   16 ++++++++++++++++
>  src/qemu_conf.c   |   41 ++++++++++++++++++++++++++++++++++++++---
>  src/qemu_conf.h   |    3 ++-
>  4 files changed, 82 insertions(+), 12 deletions(-)
> 
> diff --git a/src/domain_conf.c b/src/domain_conf.c
> index f696b6a..efd6981 100644
> --- a/src/domain_conf.c
> +++ b/src/domain_conf.c
> @@ -1,7 +1,7 @@
>  /*
>   * domain_conf.c: domain XML processing
>   *
> - * Copyright (C) 2006-2008 Red Hat, Inc.
> + * Copyright (C) 2006-2009 Red Hat, Inc.
>   * Copyright (C) 2006-2008 Daniel P. Berrange
>   *
>   * This library is free software; you can redistribute it and/or
> @@ -551,6 +551,17 @@ int virDomainDiskCompare(virDomainDiskDefPtr a,
> 
> 
>  #ifndef PROXY
> +
> +/* map from xml cache tag to internal cache mode
> + */
> +VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
> +    "",         /* reserved -- mode not specified */
> +    "off",
> +    "on",
> +    "none",
> +    "writeback",
> +    "writethrough");

This is  still wrong - the XML should only accept 'none',
'writeback', and 'writethrough', or 'default'. It shouldn't
allow QEMU's 'on' or 'off' values - that's an internal impl
detail

> diff --git a/src/domain_conf.h b/src/domain_conf.h
> index 09afd1f..c72c0dc 100644
> --- a/src/domain_conf.h
> +++ b/src/domain_conf.h
> @@ -81,6 +81,21 @@ enum virDomainDiskBus {
>      VIR_DOMAIN_DISK_BUS_LAST
>  };
> 
> +/* summary of all possible host open file cache modes
> + */
> +typedef enum {
> +    VIR_DOMAIN_DISK_CACHE_UNSPECIFIED,	/* reserved */
> +    VIR_DOMAIN_DISK_CACHE_OFF,
> +    VIR_DOMAIN_DISK_CACHE_ON,
> +    VIR_DOMAIN_DISK_CACHE_DISABLE,
> +    VIR_DOMAIN_DISK_CACHE_WRITEBACK,
> +    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
> +
> +    VIR_DOMAIN_DISK_CACHE_LAST
> +    } virDomainDiskCache;

Likewise ON/OFF should not be used here.

> +VIR_ENUM_DECL(qemu_cache_map)
> +
> +/* map from internal cache mode to qemu cache arg text
> + *
> + * Note: currently this replicates virDomainDiskCache, but will need to
> + * error flag potential new entries in virDomainDiskCache which are
> + * not supported by qemu (raising exceptions as appropriate).
> + */
> +VIR_ENUM_IMPL(qemu_cache_map, VIR_DOMAIN_DISK_CACHE_LAST,
> +    "",         /* reserved -- mode not specified */
> +    "off",      /* deprecated; use "none" */
> +    "on",       /* obsolete;   use "writethrough" */
> +    "none",
> +    "writeback",
> +    "writethrough")

This needs to have two separate enums, one for old style, one for
new style option naming

> @@ -1012,6 +1030,24 @@ int qemudBuildCommandLine(virConnectPtr conn,
>              if (disk->driverType)
>                  virBufferVSprintf(&opt, ",fmt=%s", disk->driverType);
> 
> +            unsigned int qf;
> +            int cachemode = disk->cachemode;
> +            if (cachemode) {
> +                if (qemudExtractVersionInfo(vm->def->emulator, NULL, &qf) < 0)
> +                    ;    /* error reported */

This will SEGV, because vm->def->emulator is not required to be present
here. The command line flags are already extract & available further
up in this method, so its redundant to extract them again.

> +                else if (!(qf & QEMUD_CMD_FLAG_DRIVE_CACHEMODE)
> +                         && cachemode == VIR_DOMAIN_DISK_CACHE_WRITETHRU)
> +                    cachemode = VIR_DOMAIN_DISK_CACHE_ON;
> +                else if (qf & QEMUD_CMD_FLAG_DRIVE_CACHEMODE
> +                         && cachemode == VIR_DOMAIN_DISK_CACHE_ON)
> +                    cachemode = VIR_DOMAIN_DISK_CACHE_WRITETHRU;
> +            }
> +            if (cachemode || (disk->shared && !disk->readonly))
> +                virBufferVSprintf(&opt, ",cache=%s",
> +                                  (cachemode
> +                                   ? qemu_cache_mapTypeToString(cachemode)
> +                                   : "off"));


Further up in this code its already adding cache=off for shared disks.

There's also quite a few code style issues, not following conventions
of the surrounding code. 

Here's a patch which addresses all that, and more importantly adds test
cases covering all the cache variants QEMU has.

 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.args |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml  |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.args   |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml    |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.args   |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml    |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.args |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml  |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.args   |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml    |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.args   |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml    |   29 +++++++
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args        |    1 
 b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml         |   30 +++++++
 src/domain_conf.c                                                   |   36 +++++++--
 src/domain_conf.h                                                   |   11 ++
 src/qemu_conf.c                                                     |   38 ++++++++--
 src/qemu_conf.h                                                     |    3 
 tests/qemuxml2argvtest.c                                            |   10 ++
 tests/qemuxml2xmltest.c                                             |    3 
 20 files changed, 298 insertions(+), 14 deletions(-)


Daniel

diff -r 2ff2ff7734c2 src/domain_conf.c
--- a/src/domain_conf.c	Fri Jan 30 11:01:52 2009 +0000
+++ b/src/domain_conf.c	Fri Jan 30 12:28:00 2009 +0000
@@ -1,7 +1,7 @@
 /*
  * domain_conf.c: domain XML processing
  *
- * Copyright (C) 2006-2008 Red Hat, Inc.
+ * Copyright (C) 2006-2009 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -91,6 +91,12 @@ VIR_ENUM_IMPL(virDomainDiskBus, VIR_DOMA
               "usb",
               "uml")
 
+VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
+              "default",
+              "none",
+              "writethrough",
+              "writeback");
+
 VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "mount",
               "block",
@@ -568,6 +574,7 @@ virDomainDiskDefParseXML(virConnectPtr c
     char *source = NULL;
     char *target = NULL;
     char *bus = NULL;
+    char *cachetag = NULL;
 
     if (VIR_ALLOC(def) < 0) {
         virReportOOMError(conn);
@@ -617,6 +624,7 @@ virDomainDiskDefParseXML(virConnectPtr c
                        (xmlStrEqual(cur->name, BAD_CAST "driver"))) {
                 driverName = virXMLPropString(cur, "name");
                 driverType = virXMLPropString(cur, "type");
+                cachetag = virXMLPropString(cur, "cache");
             } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
                 def->readonly = 1;
             } else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
@@ -713,6 +721,13 @@ virDomainDiskDefParseXML(virConnectPtr c
         goto error;
     }
 
+    if (cachetag &&
+        (def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
+        virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown disk cache mode '%s'"), cachetag);
+        goto error;
+    }
+
     def->src = source;
     source = NULL;
     def->dst = target;
@@ -730,6 +745,7 @@ cleanup:
     VIR_FREE(device);
     VIR_FREE(driverType);
     VIR_FREE(driverName);
+    VIR_FREE(cachetag);
 
     return def;
 
@@ -2756,6 +2772,7 @@ virDomainDiskDefFormat(virConnectPtr con
     const char *type = virDomainDiskTypeToString(def->type);
     const char *device = virDomainDiskDeviceTypeToString(def->device);
     const char *bus = virDomainDiskBusTypeToString(def->bus);
+    const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
 
     if (!type) {
         virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -2772,20 +2789,23 @@ virDomainDiskDefFormat(virConnectPtr con
                              _("unexpected disk bus %d"), def->bus);
         return -1;
     }
+    if (!cachemode) {
+        virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unexpected disk cache mode %d"), def->cachemode);
+        return -1;
+    }
 
     virBufferVSprintf(buf,
                       "    <disk type='%s' device='%s'>\n",
                       type, device);
 
     if (def->driverName) {
+        virBufferVSprintf(buf, "      <driver name='%s'", def->driverName);
         if (def->driverType)
-            virBufferVSprintf(buf,
-                              "      <driver name='%s' type='%s'/>\n",
-                              def->driverName, def->driverType);
-        else
-            virBufferVSprintf(buf,
-                              "      <driver name='%s'/>\n",
-                              def->driverName);
+            virBufferVSprintf(buf, " type='%s'", def->driverType);
+        if (def->cachemode)
+            virBufferVSprintf(buf, " cache='%s'", cachemode);
+        virBufferVSprintf(buf, "/>\n");
     }
 
     if (def->src) {
diff -r 2ff2ff7734c2 src/domain_conf.h
--- a/src/domain_conf.h	Fri Jan 30 11:01:52 2009 +0000
+++ b/src/domain_conf.h	Fri Jan 30 12:28:00 2009 +0000
@@ -81,6 +81,15 @@ enum virDomainDiskBus {
     VIR_DOMAIN_DISK_BUS_LAST
 };
 
+enum  virDomainDiskCache {
+    VIR_DOMAIN_DISK_CACHE_DEFAULT,
+    VIR_DOMAIN_DISK_CACHE_DISABLE,
+    VIR_DOMAIN_DISK_CACHE_WRITETHRU,
+    VIR_DOMAIN_DISK_CACHE_WRITEBACK,
+
+    VIR_DOMAIN_DISK_CACHE_LAST
+};
+
 /* Stores the virtual disk configuration */
 typedef struct _virDomainDiskDef virDomainDiskDef;
 typedef virDomainDiskDef *virDomainDiskDefPtr;
@@ -92,6 +101,7 @@ struct _virDomainDiskDef {
     char *dst;
     char *driverName;
     char *driverType;
+    int cachemode;
     unsigned int readonly : 1;
     unsigned int shared : 1;
     int slotnum; /* pci slot number for unattach */
@@ -615,6 +625,7 @@ VIR_ENUM_DECL(virDomainLifecycle)
 VIR_ENUM_DECL(virDomainDisk)
 VIR_ENUM_DECL(virDomainDiskDevice)
 VIR_ENUM_DECL(virDomainDiskBus)
+VIR_ENUM_DECL(virDomainDiskCache)
 VIR_ENUM_DECL(virDomainFS)
 VIR_ENUM_DECL(virDomainNet)
 VIR_ENUM_DECL(virDomainChr)
diff -r 2ff2ff7734c2 src/qemu_conf.c
--- a/src/qemu_conf.c	Fri Jan 30 11:01:52 2009 +0000
+++ b/src/qemu_conf.c	Fri Jan 30 12:28:00 2009 +0000
@@ -1,7 +1,7 @@
 /*
  * config.c: VM configuration management
  *
- * Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -61,6 +61,22 @@ VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_
               "uml")
 
 
+VIR_ENUM_DECL(qemuDiskCacheV1)
+VIR_ENUM_DECL(qemuDiskCacheV2)
+
+VIR_ENUM_IMPL(qemuDiskCacheV1, VIR_DOMAIN_DISK_CACHE_LAST,
+              "default",
+              "off",
+              "off", /* writethrough not supported, so for safety, disable */
+              "on"); /* Old 'on' was equivalent to 'writeback' */
+
+VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAIN_DISK_CACHE_LAST,
+              "default",
+              "none",
+              "writethrough",
+              "writeback");
+
+
 #define qemudLog(level, msg...) fprintf(stderr, msg)
 
 int qemudLoadDriverConfig(struct qemud_driver *driver,
@@ -398,8 +414,11 @@ int qemudExtractVersionInfo(const char *
         flags |= QEMUD_CMD_FLAG_UUID;
     if (strstr(help, "-domid"))
         flags |= QEMUD_CMD_FLAG_DOMID;
-    if (strstr(help, "-drive"))
+    if (strstr(help, "-drive")) {
         flags |= QEMUD_CMD_FLAG_DRIVE;
+        if (strstr(help, "cache=writethrough|writeback|none"))
+            flags |= QEMUD_CMD_FLAG_DRIVE_CACHE_V2;
+    }
     if (strstr(help, "boot=on"))
         flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
     if (version >= 9000)
@@ -591,6 +610,7 @@ qemudNetworkIfaceConnect(virConnectPtr c
     return NULL;
 }
 
+
 static int qemudBuildCommandLineChrDevStr(virDomainChrDefPtr dev,
                                           char *buf,
                                           int buflen)
@@ -1015,11 +1035,20 @@ int qemudBuildCommandLine(virConnectPtr 
             if (bootable &&
                 disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
                 virBufferAddLit(&opt, ",boot=on");
-            if (disk->shared && !disk->readonly)
-                virBufferAddLit(&opt, ",cache=off");
             if (disk->driverType)
                 virBufferVSprintf(&opt, ",fmt=%s", disk->driverType);
 
+            if (disk->cachemode) {
+                const char *mode =
+                    (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_CACHE_V2) ?
+                    qemuDiskCacheV2TypeToString(disk->cachemode) :
+                    qemuDiskCacheV1TypeToString(disk->cachemode);
+
+                virBufferVSprintf(&opt, ",cache=%s", mode);
+            } else if (disk->shared && !disk->readonly) {
+                virBufferAddLit(&opt, ",cache=off");
+            }
+
             if (virBufferError(&opt)) {
                 virReportOOMError(conn);
                 goto error;
@@ -1585,4 +1614,3 @@ cleanup:
     VIR_FREE(xml);
     return ret;
 }
-
diff -r 2ff2ff7734c2 src/qemu_conf.h
--- a/src/qemu_conf.h	Fri Jan 30 11:01:52 2009 +0000
+++ b/src/qemu_conf.h	Fri Jan 30 12:28:00 2009 +0000
@@ -1,7 +1,7 @@
 /*
  * config.h: VM configuration management
  *
- * Copyright (C) 2006, 2007 Red Hat, Inc.
+ * Copyright (C) 2006, 2007, 2009 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -53,6 +53,7 @@ enum qemud_cmd_flags {
                                                    * since it had a design bug blocking the entire monitor console */
     QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP  = (1 << 10), /* New migration syntax after merge to QEMU with TCP transport */
     QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC = (1 << 11), /* New migration syntax after merge to QEMU with EXEC transport */
+    QEMUD_CMD_FLAG_DRIVE_CACHE_V2    = (1 << 12), /* Is the cache= flag wanting new v2 values */
 };
 
 /* Main driver state */
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=off -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=on -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='writeback'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=off -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='writethrough'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=none -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='none'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=writeback -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='writeback'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=writethrough -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2' cache='writethrough'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,fmt=qcow2,cache=off -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff -r 2ff2ff7734c2 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml	Fri Jan 30 12:28:00 2009 +0000
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <shareable/>
+    </disk>
+    <disk type='block' device='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/HostVG/QEMUGuest2'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+    </disk>
+  </devices>
+</domain>
diff -r 2ff2ff7734c2 tests/qemuxml2argvtest.c
--- a/tests/qemuxml2argvtest.c	Fri Jan 30 11:01:52 2009 +0000
+++ b/tests/qemuxml2argvtest.c	Fri Jan 30 12:28:00 2009 +0000
@@ -201,6 +201,16 @@ mymain(int argc, char **argv)
             QEMUD_CMD_FLAG_DRIVE_BOOT);
     DO_TEST("disk-drive-fmt-qcow", QEMUD_CMD_FLAG_DRIVE |
             QEMUD_CMD_FLAG_DRIVE_BOOT);
+    DO_TEST("disk-drive-shared", QEMUD_CMD_FLAG_DRIVE);
+    DO_TEST("disk-drive-cache-v1-wt", QEMUD_CMD_FLAG_DRIVE);
+    DO_TEST("disk-drive-cache-v1-wb", QEMUD_CMD_FLAG_DRIVE);
+    DO_TEST("disk-drive-cache-v1-none", QEMUD_CMD_FLAG_DRIVE);
+    DO_TEST("disk-drive-cache-v2-wt", QEMUD_CMD_FLAG_DRIVE |
+            QEMUD_CMD_FLAG_DRIVE_CACHE_V2);
+    DO_TEST("disk-drive-cache-v2-wb", QEMUD_CMD_FLAG_DRIVE |
+            QEMUD_CMD_FLAG_DRIVE_CACHE_V2);
+    DO_TEST("disk-drive-cache-v2-none", QEMUD_CMD_FLAG_DRIVE |
+            QEMUD_CMD_FLAG_DRIVE_CACHE_V2);
     DO_TEST("disk-usb", 0);
     DO_TEST("graphics-vnc", 0);
     DO_TEST("graphics-sdl", 0);
diff -r 2ff2ff7734c2 tests/qemuxml2xmltest.c
--- a/tests/qemuxml2xmltest.c	Fri Jan 30 11:01:52 2009 +0000
+++ b/tests/qemuxml2xmltest.c	Fri Jan 30 12:28:00 2009 +0000
@@ -98,6 +98,9 @@ mymain(int argc, char **argv)
     DO_TEST("disk-xenvbd");
     DO_TEST("disk-usb");
     DO_TEST("disk-drive-fmt-qcow");
+    DO_TEST("disk-drive-cache-v1-wt");
+    DO_TEST("disk-drive-cache-v1-wb");
+    DO_TEST("disk-drive-cache-v1-none");
     DO_TEST("graphics-vnc");
     DO_TEST("graphics-sdl");
     DO_TEST("graphics-sdl-fullscreen");



-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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