render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 9b72a34973d7e3fa0f4072b22d6ea10ee1241ece Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <9b72a34973d7e3fa0f4072b22d6ea10ee1241ece@dist-git>
7a3408
From: Matthias Bolte <matthias.bolte@googlemail.com>
7a3408
Date: Tue, 8 Sep 2015 09:52:59 +0200
7a3408
Subject: [PATCH] vmx: Add handling for CDROM devices with SCSI passthru
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1172544
7a3408
7a3408
(cherry picked from commit 98d8c811ce09cfec707aa3729cf0c01c67471356)
7a3408
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/vmx/vmx.c                                     | 36 ++++++++--
7a3408
 tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.vmx |  6 ++
7a3408
 tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml | 24 +++++++
7a3408
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.vmx   | 85 +++++++++++++++++++++++
7a3408
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml   | 35 ++++++++++
7a3408
 tests/vmx2xmltest.c                               |  2 +
7a3408
 tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.vmx | 14 ++++
7a3408
 tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.xml | 14 ++++
7a3408
 tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.vmx   | 25 +++++++
7a3408
 tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.xml   | 35 ++++++++++
7a3408
 tests/xml2vmxtest.c                               |  2 +
7a3408
 11 files changed, 273 insertions(+), 5 deletions(-)
7a3408
 create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.vmx
7a3408
 create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
7a3408
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.vmx
7a3408
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
7a3408
 create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.vmx
7a3408
 create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.xml
7a3408
 create mode 100644 tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.vmx
7a3408
 create mode 100644 tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.xml
7a3408
7a3408
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
7a3408
index 799668c..9ba5848 100644
7a3408
--- a/src/vmx/vmx.c
7a3408
+++ b/src/vmx/vmx.c
7a3408
@@ -2178,12 +2178,14 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
7a3408
         } else if (virFileHasSuffix(fileName, ".iso") ||
7a3408
                    (deviceType &&
7a3408
                     (STRCASEEQ(deviceType, "atapi-cdrom") ||
7a3408
-                     STRCASEEQ(deviceType, "cdrom-raw")))) {
7a3408
+                     STRCASEEQ(deviceType, "cdrom-raw") ||
7a3408
+                     (STRCASEEQ(deviceType, "scsi-passthru") &&
7a3408
+                      STRPREFIX(fileName, "/vmfs/devices/cdrom/"))))) {
7a3408
             /*
7a3408
              * This function was called in order to parse a harddisk device,
7a3408
-             * but .iso files, 'atapi-cdrom', and 'cdrom-raw' devices are for
7a3408
-             * CDROM devices only. Just ignore it, another call to this
7a3408
-             * function to parse a CDROM device may handle it.
7a3408
+             * but .iso files, 'atapi-cdrom', 'cdrom-raw', and 'scsi-passthru'
7a3408
+             * CDROM devices are for CDROM devices only. Just ignore it, another
7a3408
+             * call to this function to parse a CDROM device may handle it.
7a3408
              */
7a3408
             goto ignore;
7a3408
         } else {
7a3408
@@ -2241,6 +2243,24 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
7a3408
             } else if (virDomainDiskSetSource(*def, fileName) < 0) {
7a3408
                 goto cleanup;
7a3408
             }
7a3408
+        } else if (busType == VIR_DOMAIN_DISK_BUS_SCSI &&
7a3408
+                   deviceType && STRCASEEQ(deviceType, "scsi-passthru")) {
7a3408
+            if (STRPREFIX(fileName, "/vmfs/devices/cdrom/")) {
7a3408
+                /* SCSI-passthru CD-ROMs actually are device='lun' */
7a3408
+                (*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN;
7a3408
+                virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK);
7a3408
+
7a3408
+                if (virDomainDiskSetSource(*def, fileName) < 0)
7a3408
+                    goto cleanup;
7a3408
+            } else {
7a3408
+                /*
7a3408
+                 * This function was called in order to parse a CDROM device,
7a3408
+                 * but the filename does not indicate a CDROM device. Just ignore
7a3408
+                 * it, another call to this function to parse a harddisk device
7a3408
+                 * may handle it.
7a3408
+                 */
7a3408
+                goto ignore;
7a3408
+            }
7a3408
         } else {
7a3408
             virReportError(VIR_ERR_INTERNAL_ERROR,
7a3408
                            _("Invalid or not yet handled value '%s' "
7a3408
@@ -3423,7 +3443,13 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
7a3408
         else
7a3408
             vmxDeviceType = "atapi-cdrom";
7a3408
     } else if (def->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
7a3408
-        vmxDeviceType = "cdrom-raw";
7a3408
+        const char *src = virDomainDiskGetSource(def);
7a3408
+
7a3408
+        if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI &&
7a3408
+            src && STRPREFIX(src, "/vmfs/devices/cdrom/"))
7a3408
+            vmxDeviceType = "scsi-passthru";
7a3408
+        else
7a3408
+            vmxDeviceType = "cdrom-raw";
7a3408
     } else {
7a3408
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
7a3408
                        _("%s %s '%s' has an unsupported type '%s'"),
7a3408
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.vmx
7a3408
new file mode 100644
7a3408
index 0000000..fb7ea72
7a3408
--- /dev/null
7a3408
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.vmx
7a3408
@@ -0,0 +1,6 @@
7a3408
+config.version = "8"
7a3408
+virtualHW.version = "4"
7a3408
+scsi0.present = "true"
7a3408
+scsi0:0.present = "true"
7a3408
+scsi0:0.deviceType = "scsi-passthru"
7a3408
+scsi0:0.fileName = "/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0"
7a3408
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
7a3408
new file mode 100644
7a3408
index 0000000..d3b382a
7a3408
--- /dev/null
7a3408
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
7a3408
@@ -0,0 +1,24 @@
7a3408
+<domain type='vmware'>
7a3408
+  <uuid>00000000-0000-0000-0000-000000000000</uuid>
7a3408
+  <memory unit='KiB'>32768</memory>
7a3408
+  <currentMemory unit='KiB'>32768</currentMemory>
7a3408
+  <vcpu placement='static'>1</vcpu>
7a3408
+  <os>
7a3408
+    <type arch='i686'>hvm</type>
7a3408
+  </os>
7a3408
+  <clock offset='utc'/>
7a3408
+  <on_poweroff>destroy</on_poweroff>
7a3408
+  <on_reboot>restart</on_reboot>
7a3408
+  <on_crash>destroy</on_crash>
7a3408
+  <devices>
7a3408
+    <disk type='block' device='lun'>
7a3408
+      <source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
7a3408
+      <target dev='sda' bus='scsi'/>
7a3408
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
7a3408
+    </disk>
7a3408
+    <controller type='scsi' index='0'/>
7a3408
+    <video>
7a3408
+      <model type='vmvga' vram='4096'/>
7a3408
+    </video>
7a3408
+  </devices>
7a3408
+</domain>
7a3408
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.vmx b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.vmx
7a3408
new file mode 100644
7a3408
index 0000000..f9da706
7a3408
--- /dev/null
7a3408
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.vmx
7a3408
@@ -0,0 +1,85 @@
7a3408
+.encoding = "UTF-8"
7a3408
+config.version = "8"
7a3408
+virtualHW.version = "8"
7a3408
+pciBridge0.present = "TRUE"
7a3408
+pciBridge4.present = "TRUE"
7a3408
+pciBridge4.virtualDev = "pcieRootPort"
7a3408
+pciBridge4.functions = "8"
7a3408
+pciBridge5.present = "TRUE"
7a3408
+pciBridge5.virtualDev = "pcieRootPort"
7a3408
+pciBridge5.functions = "8"
7a3408
+pciBridge6.present = "TRUE"
7a3408
+pciBridge6.virtualDev = "pcieRootPort"
7a3408
+pciBridge6.functions = "8"
7a3408
+pciBridge7.present = "TRUE"
7a3408
+pciBridge7.virtualDev = "pcieRootPort"
7a3408
+pciBridge7.functions = "8"
7a3408
+vmci0.present = "TRUE"
7a3408
+hpet0.present = "TRUE"
7a3408
+nvram = "esx-rhel6-mini.nvram"
7a3408
+virtualHW.productCompatibility = "hosted"
7a3408
+powerType.powerOff = "soft"
7a3408
+powerType.powerOn = "hard"
7a3408
+powerType.suspend = "hard"
7a3408
+powerType.reset = "soft"
7a3408
+displayName = "esx-rhel6-mini-with-scsi-device"
7a3408
+extendedConfigFile = "esx-rhel6-mini.vmxf"
7a3408
+floppy0.present = "TRUE"
7a3408
+scsi0.present = "TRUE"
7a3408
+scsi0.sharedBus = "none"
7a3408
+scsi0.virtualDev = "pvscsi"
7a3408
+memsize = "2048"
7a3408
+scsi0:0.present = "TRUE"
7a3408
+scsi0:0.fileName = "esx-rhel6-mini.vmdk"
7a3408
+scsi0:0.deviceType = "scsi-hardDisk"
7a3408
+ide1:0.present = "TRUE"
7a3408
+ide1:0.clientDevice = "TRUE"
7a3408
+ide1:0.deviceType = "cdrom-raw"
7a3408
+ide1:0.startConnected = "FALSE"
7a3408
+floppy0.startConnected = "FALSE"
7a3408
+floppy0.fileName = ""
7a3408
+floppy0.clientDevice = "TRUE"
7a3408
+ethernet0.present = "TRUE"
7a3408
+ethernet0.virtualDev = "vmxnet3"
7a3408
+ethernet0.networkName = "VM Network"
7a3408
+ethernet0.addressType = "vpx"
7a3408
+guestOS = "rhel6-64"
7a3408
+uuid.location = "56 4d 91 76 62 1f 02 39-f5 ad 3a 00 23 71 95 3b"
7a3408
+uuid.bios = "56 4d 91 76 62 1f 02 39-f5 ad 3a 00 23 71 95 3b"
7a3408
+vc.uuid = "52 40 95 33 33 a2 56 c5-36 ce 80 d6 05 f8 ec f4"
7a3408
+scsi0.pciSlotNumber = "160"
7a3408
+ethernet0.generatedAddress = "00:50:56:9f:08:51"
7a3408
+ethernet0.pciSlotNumber = "192"
7a3408
+svga.vramSize = "8388608"
7a3408
+vmci0.id = "594646331"
7a3408
+vmci0.pciSlotNumber = "32"
7a3408
+tools.syncTime = "FALSE"
7a3408
+cleanShutdown = "TRUE"
7a3408
+replay.supported = "FALSE"
7a3408
+sched.swap.derivedName = "/vmfs/volumes/4f59a359-4cc3fa06-cac0-4437e66df86c/esx-rhel6-mini/esx-rhel6-mini-f62c1180.vswp"
7a3408
+replay.filename = ""
7a3408
+scsi0:0.redo = ""
7a3408
+pciBridge0.pciSlotNumber = "17"
7a3408
+pciBridge4.pciSlotNumber = "21"
7a3408
+pciBridge5.pciSlotNumber = "22"
7a3408
+pciBridge6.pciSlotNumber = "23"
7a3408
+pciBridge7.pciSlotNumber = "24"
7a3408
+scsi0.sasWWID = "50 05 05 66 62 1f 02 30"
7a3408
+ethernet0.generatedAddressOffset = "0"
7a3408
+hostCPUID.0 = "0000000d756e65476c65746e49656e69"
7a3408
+hostCPUID.1 = "000206a70010080017bae3f7bfebfbff"
7a3408
+hostCPUID.80000001 = "00000000000000000000000128100800"
7a3408
+guestCPUID.0 = "0000000d756e65476c65746e49656e69"
7a3408
+guestCPUID.1 = "000206a700010800969822030fabfbff"
7a3408
+guestCPUID.80000001 = "00000000000000000000000128100800"
7a3408
+userCPUID.0 = "0000000d756e65476c65746e49656e69"
7a3408
+userCPUID.1 = "000206a700100800169822030fabfbff"
7a3408
+userCPUID.80000001 = "00000000000000000000000128100800"
7a3408
+evcCompatibilityMode = "FALSE"
7a3408
+vmotion.checkpointFBSize = "8388608"
7a3408
+softPowerOff = "TRUE"
7a3408
+scsi0:1.present = "TRUE"
7a3408
+scsi0:1.deviceType = "scsi-passthru"
7a3408
+scsi0:1.fileName = "/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0"
7a3408
+scsi0:1.allowGuestConnectionControl = "FALSE"
7a3408
+scsi0:3.present = "FALSE"
7a3408
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
7a3408
new file mode 100644
7a3408
index 0000000..5180a99
7a3408
--- /dev/null
7a3408
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
7a3408
@@ -0,0 +1,35 @@
7a3408
+<domain type='vmware'>
7a3408
+  <name>esx-rhel6-mini-with-scsi-device</name>
7a3408
+  <uuid>564d9176-621f-0239-f5ad-3a002371953b</uuid>
7a3408
+  <memory unit='KiB'>2097152</memory>
7a3408
+  <currentMemory unit='KiB'>2097152</currentMemory>
7a3408
+  <vcpu placement='static'>1</vcpu>
7a3408
+  <os>
7a3408
+    <type arch='x86_64'>hvm</type>
7a3408
+  </os>
7a3408
+  <clock offset='utc'/>
7a3408
+  <on_poweroff>destroy</on_poweroff>
7a3408
+  <on_reboot>restart</on_reboot>
7a3408
+  <on_crash>destroy</on_crash>
7a3408
+  <devices>
7a3408
+    <disk type='file' device='disk'>
7a3408
+      <source file='[datastore] directory/esx-rhel6-mini.vmdk'/>
7a3408
+      <target dev='sda' bus='scsi'/>
7a3408
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
7a3408
+    </disk>
7a3408
+    <disk type='block' device='lun'>
7a3408
+      <source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
7a3408
+      <target dev='sdb' bus='scsi'/>
7a3408
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
7a3408
+    </disk>
7a3408
+    <controller type='scsi' index='0' model='vmpvscsi'/>
7a3408
+    <interface type='bridge'>
7a3408
+      <mac address='00:50:56:9f:08:51'/>
7a3408
+      <source bridge='VM Network'/>
7a3408
+      <model type='vmxnet3'/>
7a3408
+    </interface>
7a3408
+    <video>
7a3408
+      <model type='vmvga' vram='8192'/>
7a3408
+    </video>
7a3408
+  </devices>
7a3408
+</domain>
7a3408
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
7a3408
index d3e33e6..1d1fe83 100644
7a3408
--- a/tests/vmx2xmltest.c
7a3408
+++ b/tests/vmx2xmltest.c
7a3408
@@ -221,6 +221,7 @@ mymain(void)
7a3408
     DO_TEST("cdrom-scsi-device", "cdrom-scsi-device");
7a3408
     DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device");
7a3408
     DO_TEST("cdrom-scsi-raw-auto-detect", "cdrom-scsi-raw-auto-detect");
7a3408
+    DO_TEST("cdrom-scsi-passthru", "cdrom-scsi-passthru");
7a3408
     DO_TEST("cdrom-ide-file", "cdrom-ide-file");
7a3408
     DO_TEST("cdrom-ide-device", "cdrom-ide-device");
7a3408
     DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device");
7a3408
@@ -261,6 +262,7 @@ mymain(void)
7a3408
     DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4");
7a3408
     DO_TEST("esx-in-the-wild-5", "esx-in-the-wild-5");
7a3408
     DO_TEST("esx-in-the-wild-6", "esx-in-the-wild-6");
7a3408
+    DO_TEST("esx-in-the-wild-7", "esx-in-the-wild-7");
7a3408
 
7a3408
     DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1");
7a3408
     DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2");
7a3408
diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.vmx
7a3408
new file mode 100644
7a3408
index 0000000..be2f089
7a3408
--- /dev/null
7a3408
+++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.vmx
7a3408
@@ -0,0 +1,14 @@
7a3408
+.encoding = "UTF-8"
7a3408
+config.version = "8"
7a3408
+virtualHW.version = "4"
7a3408
+guestOS = "other"
7a3408
+uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
7a3408
+displayName = "cdrom-scsi-passthru"
7a3408
+memsize = "4"
7a3408
+numvcpus = "1"
7a3408
+scsi0.present = "true"
7a3408
+scsi0:0.present = "true"
7a3408
+scsi0:0.deviceType = "scsi-passthru"
7a3408
+scsi0:0.fileName = "/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0"
7a3408
+floppy0.present = "false"
7a3408
+floppy1.present = "false"
7a3408
diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.xml
7a3408
new file mode 100644
7a3408
index 0000000..0bf3696
7a3408
--- /dev/null
7a3408
+++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-passthru.xml
7a3408
@@ -0,0 +1,14 @@
7a3408
+<domain type='vmware'>
7a3408
+  <name>cdrom-scsi-passthru</name>
7a3408
+  <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
7a3408
+  <memory unit='KiB'>4096</memory>
7a3408
+  <os>
7a3408
+    <type>hvm</type>
7a3408
+  </os>
7a3408
+  <devices>
7a3408
+    <disk type='block' device='lun'>
7a3408
+      <source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
7a3408
+      <target dev='sda' bus='scsi'/>
7a3408
+    </disk>
7a3408
+  </devices>
7a3408
+</domain>
7a3408
diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.vmx b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.vmx
7a3408
new file mode 100644
7a3408
index 0000000..2eedd35
7a3408
--- /dev/null
7a3408
+++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.vmx
7a3408
@@ -0,0 +1,25 @@
7a3408
+.encoding = "UTF-8"
7a3408
+config.version = "8"
7a3408
+virtualHW.version = "4"
7a3408
+guestOS = "other-64"
7a3408
+uuid.bios = "56 4d 91 76 62 1f 02 39-f5 ad 3a 00 23 71 95 3b"
7a3408
+displayName = "esx-rhel6-mini-with-scsi-device"
7a3408
+memsize = "2048"
7a3408
+numvcpus = "1"
7a3408
+scsi0.present = "true"
7a3408
+scsi0.virtualDev = "pvscsi"
7a3408
+scsi0:0.present = "true"
7a3408
+scsi0:0.deviceType = "scsi-hardDisk"
7a3408
+scsi0:0.fileName = "/vmfs/volumes/datastore/directory/esx-rhel6-mini.vmdk"
7a3408
+scsi0:1.present = "true"
7a3408
+scsi0:1.deviceType = "scsi-passthru"
7a3408
+scsi0:1.fileName = "/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0"
7a3408
+floppy0.present = "false"
7a3408
+floppy1.present = "false"
7a3408
+ethernet0.present = "true"
7a3408
+ethernet0.virtualDev = "vmxnet3"
7a3408
+ethernet0.networkName = "VM Network"
7a3408
+ethernet0.connectionType = "bridged"
7a3408
+ethernet0.addressType = "vpx"
7a3408
+ethernet0.generatedAddress = "00:50:56:9f:08:51"
7a3408
+svga.vramSize = "8388608"
7a3408
diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.xml b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.xml
7a3408
new file mode 100644
7a3408
index 0000000..5180a99
7a3408
--- /dev/null
7a3408
+++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-7.xml
7a3408
@@ -0,0 +1,35 @@
7a3408
+<domain type='vmware'>
7a3408
+  <name>esx-rhel6-mini-with-scsi-device</name>
7a3408
+  <uuid>564d9176-621f-0239-f5ad-3a002371953b</uuid>
7a3408
+  <memory unit='KiB'>2097152</memory>
7a3408
+  <currentMemory unit='KiB'>2097152</currentMemory>
7a3408
+  <vcpu placement='static'>1</vcpu>
7a3408
+  <os>
7a3408
+    <type arch='x86_64'>hvm</type>
7a3408
+  </os>
7a3408
+  <clock offset='utc'/>
7a3408
+  <on_poweroff>destroy</on_poweroff>
7a3408
+  <on_reboot>restart</on_reboot>
7a3408
+  <on_crash>destroy</on_crash>
7a3408
+  <devices>
7a3408
+    <disk type='file' device='disk'>
7a3408
+      <source file='[datastore] directory/esx-rhel6-mini.vmdk'/>
7a3408
+      <target dev='sda' bus='scsi'/>
7a3408
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
7a3408
+    </disk>
7a3408
+    <disk type='block' device='lun'>
7a3408
+      <source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
7a3408
+      <target dev='sdb' bus='scsi'/>
7a3408
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
7a3408
+    </disk>
7a3408
+    <controller type='scsi' index='0' model='vmpvscsi'/>
7a3408
+    <interface type='bridge'>
7a3408
+      <mac address='00:50:56:9f:08:51'/>
7a3408
+      <source bridge='VM Network'/>
7a3408
+      <model type='vmxnet3'/>
7a3408
+    </interface>
7a3408
+    <video>
7a3408
+      <model type='vmvga' vram='8192'/>
7a3408
+    </video>
7a3408
+  </devices>
7a3408
+</domain>
7a3408
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
7a3408
index 357f1e6..53efe31 100644
7a3408
--- a/tests/xml2vmxtest.c
7a3408
+++ b/tests/xml2vmxtest.c
7a3408
@@ -237,6 +237,7 @@ mymain(void)
7a3408
     DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", 4);
7a3408
     DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device", 4);
7a3408
     DO_TEST("cdrom-scsi-raw-auto-detect", "cdrom-scsi-raw-auto-detect", 4);
7a3408
+    DO_TEST("cdrom-scsi-passthru", "cdrom-scsi-passthru", 4);
7a3408
     DO_TEST("cdrom-ide-file", "cdrom-ide-file", 4);
7a3408
     DO_TEST("cdrom-ide-device", "cdrom-ide-device", 4);
7a3408
     DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device", 4);
7a3408
@@ -274,6 +275,7 @@ mymain(void)
7a3408
     DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4", 4);
7a3408
     DO_TEST("esx-in-the-wild-5", "esx-in-the-wild-5", 4);
7a3408
     DO_TEST("esx-in-the-wild-6", "esx-in-the-wild-6", 4);
7a3408
+    DO_TEST("esx-in-the-wild-7", "esx-in-the-wild-7", 4);
7a3408
 
7a3408
     DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1", 4);
7a3408
     DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2", 4);
7a3408
-- 
7a3408
2.5.2
7a3408