Blame SOURCES/kvm-block-don-t-add-driver-to-options-when-referring-to-.patch

4a2fec
From 9ffa9f42dd630e01a507905b60cc7f45d8326327 Mon Sep 17 00:00:00 2001
4a2fec
From: Kevin Wolf <kwolf@redhat.com>
4a2fec
Date: Thu, 30 Nov 2017 16:17:47 +0100
4a2fec
Subject: [PATCH 08/36] block: don't add 'driver' to options when referring to
4a2fec
 backing via node name
4a2fec
4a2fec
RH-Author: Kevin Wolf <kwolf@redhat.com>
4a2fec
Message-id: <20171130161747.18388-2-kwolf@redhat.com>
4a2fec
Patchwork-id: 78023
4a2fec
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH 1/1] block: don't add 'driver' to options when referring to backing via node name
4a2fec
Bugzilla: 1505701
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: Max Reitz <mreitz@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
4a2fec
From: Peter Krempa <pkrempa@redhat.com>
4a2fec
4a2fec
When referring to a backing file of an image via node name
4a2fec
bdrv_open_backing_file would add the 'driver' option to the option list
4a2fec
filling it with the backing format driver. This breaks construction of
4a2fec
the backing chain via -blockdev, as bdrv_open_inherit reports an error
4a2fec
if both 'reference' and 'options' are provided.
4a2fec
4a2fec
$ qemu-img create -f raw /tmp/backing.raw 64M
4a2fec
$ qemu-img create -f qcow2 -F raw -b /tmp/backing.raw /tmp/test.qcow2
4a2fec
$ qemu-system-x86_64 \
4a2fec
  -blockdev driver=file,filename=/tmp/backing.raw,node-name=backing \
4a2fec
  -blockdev driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing
4a2fec
qemu-system-x86_64: -blockdev driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing: Could not open backing file: Cannot reference an existing block device with additional options or a new filename
4a2fec
4a2fec
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4a2fec
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
(cherry picked from commit 6bff597bf6580ecc691258e849f652911dbdda7c)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 block.c | 3 ++-
4a2fec
 1 file changed, 2 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/block.c b/block.c
4a2fec
index 3308814..6fb4e98 100644
4a2fec
--- a/block.c
4a2fec
+++ b/block.c
4a2fec
@@ -2178,7 +2178,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
4a2fec
         goto free_exit;
4a2fec
     }
4a2fec
 
4a2fec
-    if (bs->backing_format[0] != '\0' && !qdict_haskey(options, "driver")) {
4a2fec
+    if (!reference &&
4a2fec
+        bs->backing_format[0] != '\0' && !qdict_haskey(options, "driver")) {
4a2fec
         qdict_put_str(options, "driver", bs->backing_format);
4a2fec
     }
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec