Mark it explicitly as read only in accordance with the comment outlining
configuration.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/vmx/vmx.c | 3 +++
tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-passthru.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml | 1 +
tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 1 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 3 +++
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml | 1 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 1 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-6.xml | 1 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-7.xml | 1 +
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml | 1 +
tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 1 +
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-1.xml | 1 +
tests/vmx2xmldata/vmx2xml-ws-in-the-wild-2.xml | 1 +
22 files changed, 26 insertions(+)
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 @@
<disk type='block' device='cdrom'>
<source dev='/dev/scd0'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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-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 @@
<devices>
<disk type='block' device='cdrom'>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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-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 @@
<devices>
<disk type='file' device='cdrom'>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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 98548e9da8..03d8eaec8e 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml
@@ -15,6 +15,7 @@
<disk type='file' device='cdrom'>
<source file='[datastore] directory/cdrom.iso'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source startupPolicy='optional'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source dev='/dev/scd0'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<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 9e5a985788..48453d4a3c 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml
@@ -15,6 +15,7 @@
<disk type='block' device='cdrom'>
<source dev='/dev/scd0'/>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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-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 @@
<devices>
<disk type='file' device='cdrom'>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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 e79927ada8..977655cb53 100644
--- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
+++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml
@@ -15,6 +15,7 @@
<disk type='file' device='cdrom'>
<source file='[datastore] directory/cdrom.iso'/>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source startupPolicy='optional'/>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source dev='/dev/scd0'/>
<target dev='sda' bus='scsi'/>
+ <readonly/>
<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 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 @@
<disk type='file' device='cdrom'>
<source file='[datastore] directory/Debian1-cdrom.iso'/>
<target dev='sdp' bus='scsi'/>
+ <readonly/>
<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'/>
+ <readonly/>
<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'/>
+ <readonly/>
<address type='drive' controller='0' bus='0'
target='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
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 @@
<disk type='file' device='cdrom'>
<source file='[498076b2-02796c1a-ef5b-000ae484a6a3]
Isos/debian-testing-amd64-netinst.iso'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<address type='drive' controller='0' bus='0'
target='0' unit='0'/>
</disk>
<disk type='file' device='floppy'>
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 @@
<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'/>
+ <readonly/>
<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 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 @@
<disk type='file' device='cdrom'>
<source file='/usr/lib/vmware/isoimages/linux.iso'/>
<target dev='hdc' bus='ide'/>
+ <readonly/>
<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-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 @@
<disk type='block' device='lun'>
<source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
<target dev='sdb' bus='scsi'/>
+ <readonly/>
<address type='drive' controller='0' bus='0'
target='0' unit='1'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
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 @@
<disk type='file' device='cdrom'>
<source file='[692eb778-2d4937fe] CentOS-4.7.ServerCD-x86_64.iso'/>
<target dev='sda' bus='sata'/>
+ <readonly/>
<address type='drive' controller='0' bus='0'
target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
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 @@
<disk type='block' device='cdrom'>
<source startupPolicy='optional'/>
<target dev='hda' bus='ide'/>
+ <readonly/>
<address type='drive' controller='0' bus='0'
target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='buslogic'/>
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 @@
<disk type='file' device='cdrom'>
<source file='/usr/lib/vmware/isoimages/linux.iso'/>
<target dev='hdc' bus='ide'/>
+ <readonly/>
<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 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 @@
<disk type='file' device='cdrom'>
<source file='/usr/lib/vmware/isoimages/linux.iso'/>
<target dev='hdc' bus='ide'/>
+ <readonly/>
<address type='drive' controller='0' bus='1'
target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='lsilogic'/>
--
2.30.2