|
|
26ba25 |
From 199b75933947cbfdedb3b1afd74ec1d24b9379b0 Mon Sep 17 00:00:00 2001
|
|
|
26ba25 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Date: Thu, 10 Jan 2019 12:44:40 +0000
|
|
|
26ba25 |
Subject: [PATCH 10/14] block: Make auto-read-only=on default for -drive
|
|
|
26ba25 |
|
|
|
26ba25 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Message-id: <20190110124442.30132-11-kwolf@redhat.com>
|
|
|
26ba25 |
Patchwork-id: 83958
|
|
|
26ba25 |
O-Subject: [RHEL-8.0 qemu-kvm PATCH 10/12] block: Make auto-read-only=on default for -drive
|
|
|
26ba25 |
Bugzilla: 1644996
|
|
|
26ba25 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
26ba25 |
|
|
|
26ba25 |
While we want machine interfaces like -blockdev and QMP blockdev-add to
|
|
|
26ba25 |
add as little auto-detection as possible so that management tools are
|
|
|
26ba25 |
explicit about their needs, -drive is a convenience option for human
|
|
|
26ba25 |
users. Enabling auto-read-only=on by default there enables users to use
|
|
|
26ba25 |
read-only images for read-only guest devices without having to specify
|
|
|
26ba25 |
read-only=on explicitly. If they try to attach the image to a read-write
|
|
|
26ba25 |
device, they will still get an error message.
|
|
|
26ba25 |
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
26ba25 |
(cherry picked from commit 9384a444f6ebcd66bba0ae3c8434120d03c8dfea)
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
26ba25 |
---
|
|
|
26ba25 |
blockdev.c | 1 +
|
|
|
26ba25 |
1 file changed, 1 insertion(+)
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
26ba25 |
index be650d0..f3b60f6 100644
|
|
|
26ba25 |
--- a/blockdev.c
|
|
|
26ba25 |
+++ b/blockdev.c
|
|
|
26ba25 |
@@ -590,6 +590,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
|
|
|
26ba25 |
qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off");
|
|
|
26ba25 |
qdict_set_default_str(bs_opts, BDRV_OPT_READ_ONLY,
|
|
|
26ba25 |
read_only ? "on" : "off");
|
|
|
26ba25 |
+ qdict_set_default_str(bs_opts, BDRV_OPT_AUTO_READ_ONLY, "on");
|
|
|
26ba25 |
assert((bdrv_flags & BDRV_O_CACHE_MASK) == 0);
|
|
|
26ba25 |
|
|
|
26ba25 |
if (runstate_check(RUN_STATE_INMIGRATE)) {
|
|
|
26ba25 |
--
|
|
|
26ba25 |
1.8.3.1
|
|
|
26ba25 |
|