aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaphtali Sprei <nsprei@redhat.com>2010-03-23 12:17:16 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-04-08 11:11:21 +0200
commit2db7ad59fc51ac948a0574bea00bfe389b624e8b (patch)
tree18518049ea2ea6ff29057f58554b5c0b01df1d7b
parentf7c11b535040df31cc8bc3b1f0c33f546073ee62 (diff)
read-only: allow read-only CDROM with any interface
Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r--vl.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/vl.c b/vl.c
index 6768cf1251..2306acee2a 100644
--- a/vl.c
+++ b/vl.c
@@ -1185,19 +1185,16 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
bdrv_flags &= ~BDRV_O_NATIVE_AIO;
}
- if (ro == 1) {
+ if (media == MEDIA_CDROM) {
+ /* CDROM is fine for any interface, don't check. */
+ ro = 1;
+ } else if (ro == 1) {
if (type != IF_SCSI && type != IF_VIRTIO && type != IF_FLOPPY) {
fprintf(stderr, "qemu: readonly flag not supported for drive with this interface\n");
return NULL;
}
}
- /*
- * cdrom is read-only. Set it now, after above interface checking
- * since readonly attribute not explicitly required, so no error.
- */
- if (media == MEDIA_CDROM) {
- ro = 1;
- }
+
bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) {