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