|
|
218e99 |
From b760a59d212007cbe0276d6027fb24809f1330d9 Mon Sep 17 00:00:00 2001
|
|
|
218e99 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
Date: Tue, 5 Nov 2013 14:09:16 +0100
|
|
|
218e99 |
Subject: [PATCH 63/87] blockdev: fix cdrom read_only flag
|
|
|
218e99 |
|
|
|
218e99 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
Message-id: <1383660558-32096-23-git-send-email-kwolf@redhat.com>
|
|
|
218e99 |
Patchwork-id: 55401
|
|
|
218e99 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH 22/24] blockdev: fix cdrom read_only flag
|
|
|
218e99 |
Bugzilla: 978402
|
|
|
218e99 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
218e99 |
|
|
|
218e99 |
From: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
|
|
|
218e99 |
Since 0ebd24e0, cdrom doesn't have read-only on by default, which will
|
|
|
218e99 |
error out when using an read only image. Fix it by setting the default
|
|
|
218e99 |
value when parsing opts.
|
|
|
218e99 |
|
|
|
218e99 |
Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
|
|
|
218e99 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
|
|
|
218e99 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
218e99 |
(cherry picked from commit a7fdbcf0e6e52d935ebff6d849fe4b5473e5860d)
|
|
|
218e99 |
|
|
|
218e99 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
---
|
|
|
218e99 |
blockdev.c | 7 ++++---
|
|
|
218e99 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
218e99 |
|
|
|
218e99 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
218e99 |
---
|
|
|
218e99 |
blockdev.c | 7 ++++---
|
|
|
218e99 |
1 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
218e99 |
|
|
|
218e99 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
218e99 |
index a248480..a9c5d32 100644
|
|
|
218e99 |
--- a/blockdev.c
|
|
|
218e99 |
+++ b/blockdev.c
|
|
|
218e99 |
@@ -626,7 +626,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|
|
218e99 |
int cyls, heads, secs, translation;
|
|
|
218e99 |
int max_devs, bus_id, unit_id, index;
|
|
|
218e99 |
const char *devaddr;
|
|
|
218e99 |
- bool read_only, copy_on_read;
|
|
|
218e99 |
+ bool read_only = false;
|
|
|
218e99 |
+ bool copy_on_read;
|
|
|
218e99 |
Error *local_err = NULL;
|
|
|
218e99 |
|
|
|
218e99 |
/* Change legacy command line options into QMP ones */
|
|
|
218e99 |
@@ -691,7 +692,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|
|
218e99 |
media = MEDIA_DISK;
|
|
|
218e99 |
} else if (!strcmp(value, "cdrom")) {
|
|
|
218e99 |
media = MEDIA_CDROM;
|
|
|
218e99 |
- qdict_put(bs_opts, "read-only", qstring_from_str("on"));
|
|
|
218e99 |
+ read_only = true;
|
|
|
218e99 |
} else {
|
|
|
218e99 |
error_report("'%s' invalid media", value);
|
|
|
218e99 |
goto fail;
|
|
|
218e99 |
@@ -699,7 +700,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|
|
218e99 |
}
|
|
|
218e99 |
|
|
|
218e99 |
/* copy-on-read is disabled with a warning for read-only devices */
|
|
|
218e99 |
- read_only = qemu_opt_get_bool(legacy_opts, "read-only", false);
|
|
|
218e99 |
+ read_only |= qemu_opt_get_bool(legacy_opts, "read-only", false);
|
|
|
218e99 |
copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false);
|
|
|
218e99 |
|
|
|
218e99 |
if (read_only && copy_on_read) {
|
|
|
218e99 |
--
|
|
|
218e99 |
1.7.1
|
|
|
218e99 |
|