According to VMWare's documentation 'cdrom-raw' is an acceptable value
for deviceType for a CD-ROM drive.
ide|scsi(n):(n).deviceType = "cdrom-raw|atapi-cdrom|cdrom-image"
'cdrom-raw' appears to pass on your host CD-ROM instead of emulating an
ATAPI CD-ROM drive.
---
src/vmx/vmx.c | 12 ++++++-----
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 +++++
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 ++++++++++++++++++++++
tests/vmx2xmltest.c | 1 +
4 files changed, 37 insertions(+), 5 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 35afe26..e6b2c74 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2174,12 +2174,13 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
virConfPtr con
goto cleanup;
}
} else if (virFileHasSuffix(fileName, ".iso") ||
- STRCASEEQ(deviceType, "atapi-cdrom")) {
+ STRCASEEQ(deviceType, "atapi-cdrom") ||
+ STRCASEEQ(deviceType, "cdrom-raw")) {
/*
* This function was called in order to parse a harddisk device,
- * but .iso files and 'atapi-cdrom' devices are for CDROM devices
- * only. Just ignore it, another call to this function to parse a
- * CDROM device may handle it.
+ * but .iso files, 'atapi-cdrom', and 'cdrom-raw' devices are
for
+ * CDROM devices only. Just ignore it, another call to this
+ * function to parse a CDROM device may handle it.
*/
goto ignore;
} else {
@@ -2215,7 +2216,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
virConfPtr con
* handle it.
*/
goto ignore;
- } else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
+ } else if (STRCASEEQ(deviceType, "atapi-cdrom") ||
+ STRCASEEQ(deviceType, "cdrom-raw")) {
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
(*def)->src = fileName;
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx
b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx
new file mode 100644
index 0000000..1648111
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx
@@ -0,0 +1,5 @@
+config.version = "8"
+virtualHW.version = "4"
+ide0:0.present = "true"
+ide0:0.deviceType = "cdrom-raw"
+ide0:0.fileName = "/dev/scd0"
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
new file mode 100644
index 0000000..a4bf33c
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
@@ -0,0 +1,24 @@
+<domain type='vmware'>
+ <uuid>00000000-0000-0000-0000-000000000000</uuid>
+ <memory unit='KiB'>32768</memory>
+ <currentMemory unit='KiB'>32768</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='block' device='cdrom'>
+ <source dev='/dev/scd0'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <video>
+ <model type='vmvga' vram='4096'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index c9616de..1b97520 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -239,6 +239,7 @@ mymain(void)
DO_TEST("cdrom-scsi-device", "cdrom-scsi-device");
DO_TEST("cdrom-ide-file", "cdrom-ide-file");
DO_TEST("cdrom-ide-device", "cdrom-ide-device");
+ DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device");
DO_TEST("floppy-file", "floppy-file");
DO_TEST("floppy-device", "floppy-device");
--
1.8.1.5