Blame SOURCES/kvm-block-Make-auto-read-only-on-default-for-drive.patch

7711c0
From b6ffe1491ccf08594837991b5a9ead762b65ca97 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Fri, 23 Nov 2018 10:41:52 +0100
7711c0
Subject: [PATCH 11/34] block: Make auto-read-only=on default for -drive
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20181123104154.13541-11-kwolf@redhat.com>
7711c0
Patchwork-id: 83115
7711c0
O-Subject: [RHEL-7.7/7.6.z qemu-kvm-rhev PATCH v2 10/12] block: Make auto-read-only=on default for -drive
7711c0
Bugzilla: 1623986
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
RH-Acked-by: John Snow <jsnow@redhat.com>
7711c0
7711c0
While we want machine interfaces like -blockdev and QMP blockdev-add to
7711c0
add as little auto-detection as possible so that management tools are
7711c0
explicit about their needs, -drive is a convenience option for human
7711c0
users. Enabling auto-read-only=on by default there enables users to use
7711c0
read-only images for read-only guest devices without having to specify
7711c0
read-only=on explicitly. If they try to attach the image to a read-write
7711c0
device, they will still get an error message.
7711c0
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
(cherry picked from commit 9384a444f6ebcd66bba0ae3c8434120d03c8dfea)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 blockdev.c | 1 +
7711c0
 1 file changed, 1 insertion(+)
7711c0
7711c0
diff --git a/blockdev.c b/blockdev.c
7711c0
index 3d73f05..3eb1880 100644
7711c0
--- a/blockdev.c
7711c0
+++ b/blockdev.c
7711c0
@@ -631,6 +631,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
7711c0
         qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off");
7711c0
         qdict_set_default_str(bs_opts, BDRV_OPT_READ_ONLY,
7711c0
                               read_only ? "on" : "off");
7711c0
+        qdict_set_default_str(bs_opts, BDRV_OPT_AUTO_READ_ONLY, "on");
7711c0
         assert((bdrv_flags & BDRV_O_CACHE_MASK) == 0);
7711c0
 
7711c0
         if (runstate_check(RUN_STATE_INMIGRATE)) {
7711c0
-- 
7711c0
1.8.3.1
7711c0