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

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