diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 7aa76c0055..65d2850f2c 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2411,6 +2411,9 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOption *xmlopt, virConf *conf,
goto cleanup;
}
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
+ /* set cdrom to read-only */
+ (*def)->src->readonly = true;
+
if (fileName && virStringHasCaseSuffix(fileName, ".vmdk")) {
/*
* This function was called in order to parse a CDROM device, but
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
index e5a242d1f4..8e67347e7d 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml
index 6af0ee0704..406c3e9cc0 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml
@@ -14,6 +14,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml
index 93670e7eb4..0c37b64dbb 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml
@@ -14,6 +14,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
index 98548e9da8..03d8eaec8e 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
index 392d580ffa..87bf2ee847 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
index c7cba73aa8..764443f4fe 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
index 9e5a985788..48453d4a3c 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml
index 3678ef38b0..a972a4f538 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml
@@ -14,6 +14,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
index e79927ada8..977655cb53 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
index b851e73b3b..c9445a1754 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
index 497066972d..41f33885a6 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml
index d7d881e4a6..3d541cb14b 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml
@@ -15,6 +15,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
index b079808363..59071b5d3a 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml
@@ -21,16 +21,19 @@
+
+
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
index d05318c7d8..cbe8eceb37 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml
@@ -20,6 +20,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
index 82643e9ffe..9eb975afe9 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
@@ -27,6 +27,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
index 913bfedf30..51c74dd8a1 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml
@@ -20,6 +20,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
index 91913a2918..c117bd62e5 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml
@@ -20,6 +20,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
index 32affb5935..0eea610709 100644
--- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml
@@ -37,6 +37,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
index f6e9f4acdf..a47fab5cd5 100644
--- a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml
@@ -20,6 +20,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
index 9901033bb9..5dcc6eb48e 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml
@@ -20,6 +20,7 @@
+
diff --git a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
index 6f8f30393c..dfabb16e58 100644
--- a/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
+++ b/tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml
@@ -20,6 +20,7 @@
+