Re: [PATCH 3/9] conf: Parse and for the tray attribute

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

 



On 2012年03月09日 19:01, Daniel Veillard wrote:
On Mon, Mar 05, 2012 at 06:25:41PM +0800, Osier Yang wrote:
The "tray" is only allowed for removable disks, i.e. CDROM and
Floppy disks.

As the value for "tray" defaults to "closed", lots of tests are
updated to include "tray='closed'" in the disk target XML.

   I would take that as an indication that "tray='closed'"
should just be omitted in output and assumed on input

  src/conf/domain_conf.c                             |   33 +++++++++++++++++++-
  src/conf/domain_conf.h                             |    9 +++++
  tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml |    2 +-
  .../qemuxml2argv-boot-complex-bootindex.xml        |    6 ++--
  .../qemuxml2argvdata/qemuxml2argv-boot-complex.xml |    6 ++--
  .../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml  |    2 +-
  ...uxml2argv-boot-menu-disable-drive-bootindex.xml |    2 +-
  .../qemuxml2argv-boot-menu-disable-drive.xml       |    2 +-
  .../qemuxml2argv-boot-menu-disable.xml             |    2 +-
  .../qemuxml2argv-boot-menu-enable.xml              |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml |    4 +-
  tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml   |    2 +-
  .../qemuxml2argv-disk-cdrom-empty.xml              |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml |    2 +-
  .../qemuxml2argv-disk-copy_on_read.xml             |    2 +-
  .../qemuxml2argv-disk-drive-boot-cdrom.xml         |    2 +-
  .../qemuxml2argv-disk-drive-boot-disk.xml          |    2 +-
  .../qemuxml2argv-disk-drive-cache-directsync.xml   |    2 +-
  .../qemuxml2argv-disk-drive-cache-unsafe.xml       |    2 +-
  .../qemuxml2argv-disk-drive-cache-v1-none.xml      |    2 +-
  .../qemuxml2argv-disk-drive-cache-v1-wb.xml        |    2 +-
  .../qemuxml2argv-disk-drive-cache-v1-wt.xml        |    2 +-
  .../qemuxml2argv-disk-drive-cache-v2-none.xml      |    2 +-
  .../qemuxml2argv-disk-drive-cache-v2-wb.xml        |    2 +-
  .../qemuxml2argv-disk-drive-cache-v2-wt.xml        |    2 +-
  ...muxml2argv-disk-drive-error-policy-enospace.xml |    2 +-
  .../qemuxml2argv-disk-drive-error-policy-stop.xml  |    2 +-
  ...rgv-disk-drive-error-policy-wreport-rignore.xml |    2 +-
  .../qemuxml2argv-disk-drive-fmt-qcow.xml           |    2 +-
  .../qemuxml2argv-disk-drive-no-boot.xml            |    4 +-
  .../qemuxml2argv-disk-drive-readonly-disk.xml      |    2 +-
  .../qemuxml2argv-disk-drive-readonly-no-device.xml |    2 +-
  .../qemuxml2argv-disk-drive-shared.xml             |    2 +-
  .../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml  |    4 +-
  .../qemuxml2argv-disk-ioeventfd.xml                |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml |    2 +-
  .../qemuxml2argv-disk-snapshot.xml                 |    2 +-
  .../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml  |    2 +-
  .../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml  |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml  |    2 +-
  .../qemuxml2argv-floppy-drive-fat.xml              |    2 +-
  .../qemuxml2argv-graphics-spice-timeout.xml        |    2 +-
  tests/qemuxml2argvdata/qemuxml2argv-lease.xml      |    2 +-
  .../qemuxml2argv-net-bandwidth.xml                 |    2 +-
  .../qemuxml2xmlout-graphics-spice-timeout.xml      |    2 +-
  tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml     |    2 +-
  tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml       |    2 +-
  tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml    |    2 +-
  tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml      |    2 +-
  tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml    |    8 ++--
  tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml    |    4 +-
  tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml    |    2 +-
  tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml    |    2 +-
  tests/vmx2xmldata/vmx2xml-floppy-device.xml        |    2 +-
  tests/vmx2xmldata/vmx2xml-floppy-file.xml          |    2 +-
  tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml     |    2 +-
  tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml     |    2 +-
  59 files changed, 109 insertions(+), 69 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..f359f8f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -613,6 +613,10 @@ VIR_ENUM_IMPL(virDomainStartupPolicy, VIR_DOMAIN_STARTUP_POLICY_LAST,
                "requisite",
                "optional");

+VIR_ENUM_IMPL(virDomainDiskTray, VIR_DOMAIN_DISK_TRAY_LAST,
+              "closed",
+              "open");
+
  #define virDomainReportError(code, ...)                              \
      virReportErrorHelper(VIR_FROM_DOMAIN, code, __FILE__,            \
                           __FUNCTION__, __LINE__, __VA_ARGS__)
@@ -2894,6 +2898,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
      char *authUsage = NULL;
      char *authUUID = NULL;
      char *usageType = NULL;
+    char *tray = NULL;

      if (VIR_ALLOC(def)<  0) {
          virReportOOMError();
@@ -3002,6 +3007,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                         (xmlStrEqual(cur->name, BAD_CAST "target"))) {
                  target = virXMLPropString(cur, "dev");
                  bus = virXMLPropString(cur, "bus");
+                tray = virXMLPropString(cur, "tray");

                  /* HACK: Work around for compat with Xen
                   * driver in previous libvirt releases */
@@ -3271,6 +3277,25 @@ virDomainDiskDefParseXML(virCapsPtr caps,
          }
      }

+    if (tray) {
+        if ((def->tray_status = virDomainDiskTrayTypeFromString(tray))<  0) {
+            virDomainReportError(VIR_ERR_XML_ERROR,
+                                 _("unknown disk tray status '%s'"), tray);
+            goto error;
+        }
+
+        if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY&&
+            def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
+            virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+                                 _("tray is only valid for cdrom and floppy"));
+            goto error;
+        }
+    } else {
+        if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
+            def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+            def->tray_status = VIR_DOMAIN_DISK_TRAY_CLOSED;
+    }
+
      if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY&&
          def->bus != VIR_DOMAIN_DISK_BUS_FDC) {
          virDomainReportError(VIR_ERR_INTERNAL_ERROR,

   I don't see tray being freed here, so that sounds like a leak

@@ -10228,8 +10253,14 @@ virDomainDiskDefFormat(virBufferPtr buf,
          }
      }

-    virBufferAsprintf(buf, "<target dev='%s' bus='%s'/>\n",
+    virBufferAsprintf(buf, "<target dev='%s' bus='%s'",
                        def->dst, bus);
+    if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
+        def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)

            I would make this conditional to
            if (def->tray_status != VIR_DOMAIN_DISK_TRAY_CLOSED)
            to avoid extra default data...

+        virBufferAsprintf(buf, " tray='%s'/>\n",
+                          virDomainDiskTrayTypeToString(def->tray_status));
+    else
+        virBufferAddLit(buf, "/>\n");

      /*disk I/O throttling*/
      if (def->blkdeviotune.total_bytes_sec ||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d98a551..6fa06c7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -306,6 +306,13 @@ enum virDomainDiskProtocol {
      VIR_DOMAIN_DISK_PROTOCOL_LAST
  };

+enum virDomainDiskTray {
+    VIR_DOMAIN_DISK_TRAY_CLOSED,
+    VIR_DOMAIN_DISK_TRAY_OPEN,
+
+    VIR_DOMAIN_DISK_TRAY_LAST
+};
+
  typedef struct _virDomainDiskHostDef virDomainDiskHostDef;
  typedef virDomainDiskHostDef *virDomainDiskHostDefPtr;
  struct _virDomainDiskHostDef {
@@ -398,6 +405,7 @@ struct _virDomainDiskDef {
      char *src;
      virSecurityDeviceLabelDefPtr seclabel;
      char *dst;
+    int tray_status;
      int protocol;
      int nhosts;
      virDomainDiskHostDefPtr hosts;
@@ -2016,6 +2024,7 @@ VIR_ENUM_DECL(virDomainDiskProtocol)
  VIR_ENUM_DECL(virDomainDiskIo)
  VIR_ENUM_DECL(virDomainDiskSecretType)
  VIR_ENUM_DECL(virDomainDiskSnapshot)
+VIR_ENUM_DECL(virDomainDiskTray)
  VIR_ENUM_DECL(virDomainIoEventFd)
  VIR_ENUM_DECL(virDomainVirtioEventIdx)
  VIR_ENUM_DECL(virDomainDiskCopyOnRead)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
index 44a30de..9086528 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml
@@ -16,7 +16,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
index 8ee42e7..646aa4c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex-bootindex.xml
@@ -37,17 +37,17 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/hdc'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd1'/>
-<target dev='fdb' bus='fdc'/>
+<target dev='fdb' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
index 8ee42e7..646aa4c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-complex.xml
@@ -37,17 +37,17 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/hdc'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd1'/>
-<target dev='fdb' bus='fdc'/>
+<target dev='fdb' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
index f55ee2c..e1566c3 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-floppy.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='file' device='floppy'>
        <source file='/tmp/firmware.img'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
index 28b1b68..82a04c8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive-bootindex.xml
@@ -17,7 +17,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
index 28b1b68..82a04c8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable-drive.xml
@@ -17,7 +17,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
index 28b1b68..82a04c8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-disable.xml
@@ -17,7 +17,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
index 7847a99..2046881 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-menu-enable.xml
@@ -17,7 +17,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
index 85e6d91..07b7a85 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml
@@ -20,7 +20,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
index 69ba3c0..e805064 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml
@@ -20,7 +20,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/root/boot.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <boot order='1'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
@@ -36,7 +36,7 @@
      <disk type='file' device='floppy'>
        <driver name='qemu' type='raw'/>
        <source file='/dev/null'/>
-<target dev='fdb' bus='fdc'/>
+<target dev='fdb' bus='fdc' tray='closed'/>
        <boot order='4'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
index be07426..811e801 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bootloader.xml
@@ -16,7 +16,7 @@
      <emulator>/usr/bin/xenner</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/cdrom'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
index f1c9a42..9e6b816 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw' io='threads'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
index 8fdcb1d..85c163d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.xml
@@ -20,7 +20,7 @@
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <disk type='file' device='cdrom'>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
index ab09ed6..4378cf8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/root/boot.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
index fb0bf2b..84df929 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
@@ -23,7 +23,7 @@
        <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
index dda54f8..fbc0b09 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-cdrom.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
index cff1a42..36e2166 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-boot-disk.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
index d32d569..6a58f68 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
index f2362af..fd77bac 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-unsafe.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
index 078e2e7..d6facdb 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-none.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
index 1e575ed..262be15 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wb.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
index ffa8aba..f58b352 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v1-wt.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
index 4c33b5a..5045d70 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-none.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
index cad8257..c093f07 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wb.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
index 1af9a9f..16b77c5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-v2-wt.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
index e0182d6..bef1c7c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-enospace.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
index a1d55f9..77c4712 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
index b52d397..b09f01f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-wreport-rignore.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
index 599993c..28ed7cd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
index 2ce27a5..e6100ea 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-no-boot.xml
@@ -23,12 +23,12 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
index a3ecd9c..9c7515f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
         <source dev='/dev/sr0'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
         <readonly/>
         <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
index a3ecd9c..9c7515f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-no-device.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
         <source dev='/dev/sr0'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
         <readonly/>
         <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
index 674bbed..2b91830 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml
@@ -25,7 +25,7 @@
      <disk type='block' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
index 68e4f06..e2e85db 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-floppy.xml
@@ -21,12 +21,12 @@
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <disk type='file' device='floppy'>
        <source file='/tmp/firmware.img'/>
-<target dev='fdb' bus='fdc'/>
+<target dev='fdb' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
      <controller type='usb' index='0'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
index 00edada..4e55804 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-ioeventfd.xml
@@ -23,7 +23,7 @@
        <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
index d89e57b..692290d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-order.xml
@@ -16,7 +16,7 @@
      <emulator>/usr/bin/qemu</emulator>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
      </disk>
      <disk type='file' device='disk'>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
index 0544c05..3aa201d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
@@ -23,7 +23,7 @@
      <disk type='block' device='cdrom' snapshot='no'>
        <driver name='qemu' type='raw'/>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
index 02d1fd3..a53899a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
index 9606a52..9d1ec22 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/HostVG/QEMUGuest2'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml b/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
index a8131b9..567f4d6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml
@@ -25,7 +25,7 @@
      <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
index 48bcdb7..29c4492 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
@@ -17,7 +17,7 @@
      <disk type='dir' device='floppy'>
        <driver name='qemu' type='fat'/>
        <source dir='/var/somefiles'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
index 17fb06c..505801a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml
@@ -48,7 +48,7 @@
      <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-lease.xml b/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
index d42239c..d66af2f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-lease.xml
@@ -21,7 +21,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/root/boot.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
index 4b2e70c..ea698d0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml
@@ -30,7 +30,7 @@
      <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/home/zippy/tmp/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
index 16efb69..b2d6bfd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml
@@ -48,7 +48,7 @@
      <disk type='file' device='cdrom'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <readonly/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
index 6cbdfe9..50712a6 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='block' device='cdrom'>
        <source dev='/dev/scd0'/>
-<target dev='hda' bus='ide'/>
+<target dev='hda' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='ide' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
index 3bdb70b..de71ba6 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='file' device='cdrom'>
        <source file='[datastore] directory/cdrom.iso'/>
-<target dev='hda' bus='ide'/>
+<target dev='hda' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='ide' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
index 00fbf4e..dafd4fb 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='block' device='cdrom'>
        <source dev='/dev/scd0'/>
-<target dev='sda' bus='scsi'/>
+<target dev='sda' bus='scsi' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
index e8f2e9f..ca7ca1c 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='file' device='cdrom'>
        <source file='[datastore] directory/cdrom.iso'/>
-<target dev='sda' bus='scsi'/>
+<target dev='sda' bus='scsi' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
index 2e07963..e98bb58 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
@@ -20,17 +20,17 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='[datastore] directory/Debian1-cdrom.iso'/>
-<target dev='sdp' bus='scsi'/>
+<target dev='sdp' bus='scsi' tray='closed'/>
        <address type='drive' controller='1' bus='0' target='0' unit='0'/>
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/vmimages/tools-isoimages/linux.iso'/>
-<target dev='hda' bus='ide'/>
+<target dev='hda' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <disk type='block' device='cdrom'>
        <source dev='/dev/scd0'/>
-<target dev='hdb' bus='ide'/>
+<target dev='hdb' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
      <disk type='file' device='disk'>
@@ -40,7 +40,7 @@
      </disk>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0' model='lsilogic'/>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
index 0bc8eed..d35553f 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
@@ -19,12 +19,12 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='[498076b2-02796c1a-ef5b-000ae484a6a3] Isos/debian-testing-amd64-netinst.iso'/>
-<target dev='hda' bus='ide'/>
+<target dev='hda' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <disk type='file' device='floppy'>
        <source file='[498076b2-02796c1a-ef5b-000ae484a6a3] Debian2/dummy.flp'/>
-<target dev='fdb' bus='fdc'/>
+<target dev='fdb' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='1'/>
      </disk>
      <controller type='scsi' index='0' model='lsilogic'/>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
index ee23120..98faa9b 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
@@ -26,7 +26,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='[4af0231d-1eff559a-6369-0024e84773b6] isos/CentOS-5.5-x86_64-bin-DVD-1of2.iso'/>
-<target dev='hda' bus='ide'/>
+<target dev='hda' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0' model='lsilogic'/>
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
index 227308b..ec6a035 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
@@ -19,7 +19,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/usr/lib/vmware/isoimages/linux.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0' model='vmpvscsi'/>
diff --git a/tests/vmx2xmldata/vmx2xml-floppy-device.xml b/tests/vmx2xmldata/vmx2xml-floppy-device.xml
index 8aef9c0..d6f3bab 100644
--- a/tests/vmx2xmldata/vmx2xml-floppy-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-floppy-device.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='block' device='floppy'>
        <source dev='/dev/fd0'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='fdc' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-floppy-file.xml b/tests/vmx2xmldata/vmx2xml-floppy-file.xml
index c36e3f0..941118e 100644
--- a/tests/vmx2xmldata/vmx2xml-floppy-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-floppy-file.xml
@@ -13,7 +13,7 @@
    <devices>
      <disk type='file' device='floppy'>
        <source file='[datastore] directory/floppy.flp'/>
-<target dev='fda' bus='fdc'/>
+<target dev='fda' bus='fdc' tray='closed'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>
      <controller type='fdc' index='0'/>
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
index 4c958ae..0081adf 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
@@ -19,7 +19,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/usr/lib/vmware/isoimages/linux.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0' model='lsilogic'/>
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
index 0501a45..28753a2 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
@@ -19,7 +19,7 @@
      </disk>
      <disk type='file' device='cdrom'>
        <source file='/usr/lib/vmware/isoimages/linux.iso'/>
-<target dev='hdc' bus='ide'/>
+<target dev='hdc' bus='ide' tray='closed'/>
        <address type='drive' controller='0' bus='1' target='0' unit='0'/>
      </disk>
      <controller type='scsi' index='0' model='lsilogic'/>

   I'm not 100% sure what is the best approach but I would avoid
putting tray='closed' systematically on output.


Per 5/9 will update the domain def on the fly if tray status
is changed, so IMHO it's better to print it out always, it's
more explicit for user's eyes to make sure that the tray status
is changed indeed.

Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]