]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
read-only: allow read-only CDROM with any interface
authorNaphtali Sprei <nsprei@redhat.com>
Tue, 23 Mar 2010 10:17:16 +0000 (12:17 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 8 Apr 2010 09:11:21 +0000 (11:11 +0200)
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vl.c

diff --git a/vl.c b/vl.c
index 6768cf125185aa0c67932cb56cc41f05f090b4fe..2306acee2a00739779ab24d6d74d11c335164f19 100644 (file)
--- 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) {