* [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag
@ 2013-10-15 9:45 Fam Zheng
2013-10-15 11:07 ` Kevin Wolf
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Fam Zheng @ 2013-10-15 9:45 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha, edivaldoapereira
Since 0ebd24e0, cdrom doesn't have read-only on by default, which will
error out when using an read only image. Fix it by setting the default
value when parsing opts.
Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
v2: fix backward compatibility by force read-only with cdrom. (Kevin)
Signed-off-by: Fam Zheng <famz@redhat.com>
---
blockdev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 4f76e28..b260477 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -625,7 +625,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
int cyls, heads, secs, translation;
int max_devs, bus_id, unit_id, index;
const char *devaddr;
- bool read_only, copy_on_read;
+ bool read_only = false;
+ bool copy_on_read;
Error *local_err = NULL;
/* Change legacy command line options into QMP ones */
@@ -701,7 +702,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
media = MEDIA_DISK;
} else if (!strcmp(value, "cdrom")) {
media = MEDIA_CDROM;
- qdict_put(bs_opts, "read-only", qstring_from_str("on"));
+ read_only = true;
} else {
error_report("'%s' invalid media", value);
goto fail;
@@ -709,7 +710,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
}
/* copy-on-read is disabled with a warning for read-only devices */
- read_only = qemu_opt_get_bool(legacy_opts, "read-only", false);
+ read_only |= qemu_opt_get_bool(legacy_opts, "read-only", false);
copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false);
if (read_only && copy_on_read) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag
2013-10-15 9:45 [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag Fam Zheng
@ 2013-10-15 11:07 ` Kevin Wolf
2013-10-17 8:20 ` Stefan Hajnoczi
2013-11-05 6:25 ` Fam Zheng
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2013-10-15 11:07 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel, stefanha, edivaldoapereira
Am 15.10.2013 um 11:45 hat Fam Zheng geschrieben:
> Since 0ebd24e0, cdrom doesn't have read-only on by default, which will
> error out when using an read only image. Fix it by setting the default
> value when parsing opts.
>
> Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> ---
> v2: fix backward compatibility by force read-only with cdrom. (Kevin)
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag
2013-10-15 9:45 [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag Fam Zheng
2013-10-15 11:07 ` Kevin Wolf
@ 2013-10-17 8:20 ` Stefan Hajnoczi
2013-11-05 6:25 ` Fam Zheng
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-17 8:20 UTC (permalink / raw)
To: Fam Zheng; +Cc: kwolf, qemu-devel, stefanha, edivaldoapereira
On Tue, Oct 15, 2013 at 05:45:50PM +0800, Fam Zheng wrote:
> Since 0ebd24e0, cdrom doesn't have read-only on by default, which will
> error out when using an read only image. Fix it by setting the default
> value when parsing opts.
>
> Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> ---
> v2: fix backward compatibility by force read-only with cdrom. (Kevin)
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> blockdev.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag
2013-10-15 9:45 [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag Fam Zheng
2013-10-15 11:07 ` Kevin Wolf
2013-10-17 8:20 ` Stefan Hajnoczi
@ 2013-11-05 6:25 ` Fam Zheng
2 siblings, 0 replies; 4+ messages in thread
From: Fam Zheng @ 2013-11-05 6:25 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable
Cc'ing qemu-stable.
Fam
On 10/15/2013 05:45 PM, Fam Zheng wrote:
> Since 0ebd24e0, cdrom doesn't have read-only on by default, which will
> error out when using an read only image. Fix it by setting the default
> value when parsing opts.
>
> Reported-by: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br>
> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> ---
> v2: fix backward compatibility by force read-only with cdrom. (Kevin)
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> blockdev.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 4f76e28..b260477 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -625,7 +625,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
> int cyls, heads, secs, translation;
> int max_devs, bus_id, unit_id, index;
> const char *devaddr;
> - bool read_only, copy_on_read;
> + bool read_only = false;
> + bool copy_on_read;
> Error *local_err = NULL;
>
> /* Change legacy command line options into QMP ones */
> @@ -701,7 +702,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
> media = MEDIA_DISK;
> } else if (!strcmp(value, "cdrom")) {
> media = MEDIA_CDROM;
> - qdict_put(bs_opts, "read-only", qstring_from_str("on"));
> + read_only = true;
> } else {
> error_report("'%s' invalid media", value);
> goto fail;
> @@ -709,7 +710,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
> }
>
> /* copy-on-read is disabled with a warning for read-only devices */
> - read_only = qemu_opt_get_bool(legacy_opts, "read-only", false);
> + read_only |= qemu_opt_get_bool(legacy_opts, "read-only", false);
> copy_on_read = qemu_opt_get_bool(legacy_opts, "copy-on-read", false);
>
> if (read_only && copy_on_read) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-05 6:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 9:45 [Qemu-devel] [PATCH v2] blockdev: fix cdrom read_only flag Fam Zheng
2013-10-15 11:07 ` Kevin Wolf
2013-10-17 8:20 ` Stefan Hajnoczi
2013-11-05 6:25 ` Fam Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).