Blame SOURCES/kvm-nfs-Remove-processed-options-from-QDict.patch

1bdc94
From 27956f992c0e7622feed76bce5c5ff5cc9139e4d Mon Sep 17 00:00:00 2001
1bdc94
From: Kevin Wolf <kwolf@redhat.com>
1bdc94
Date: Tue, 26 Jun 2018 09:47:48 +0200
1bdc94
Subject: [PATCH 19/89] nfs: Remove processed options from QDict
1bdc94
1bdc94
RH-Author: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: <20180626094856.6924-6-kwolf@redhat.com>
1bdc94
Patchwork-id: 81058
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 05/73] nfs: Remove processed options from QDict
1bdc94
Bugzilla: 1513543
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Fam Zheng <famz@redhat.com>
1bdc94
1bdc94
Commit c22a03454 QAPIfied option parsing in the NFS block driver, but
1bdc94
forgot to remove all the options we processed. Therefore, we get an
1bdc94
error in bdrv_open_inherit(), which thinks the remaining options are
1bdc94
invalid. Trying to open an NFS image will result in an error like this:
1bdc94
1bdc94
    Block protocol 'nfs' doesn't support the option 'server.host'
1bdc94
1bdc94
Remove all options from the QDict to make the NFS driver work again.
1bdc94
1bdc94
Cc: qemu-stable@nongnu.org
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Message-id: 20180516160816.26259-1-kwolf@redhat.com
1bdc94
Reviewed-by: Eric Blake <eblake@redhat.com>
1bdc94
Reviewed-by: Jeff Cody <jcody@redhat.com>
1bdc94
Signed-off-by: Jeff Cody <jcody@redhat.com>
1bdc94
(cherry picked from commit c82be42cc803b36fd7aed5dceec68312c7056fd5)
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 block/nfs.c | 7 +++++++
1bdc94
 1 file changed, 7 insertions(+)
1bdc94
1bdc94
diff --git a/block/nfs.c b/block/nfs.c
1bdc94
index 3059ef2..743ca04 100644
1bdc94
--- a/block/nfs.c
1bdc94
+++ b/block/nfs.c
1bdc94
@@ -557,6 +557,7 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
1bdc94
 {
1bdc94
     BlockdevOptionsNfs *opts = NULL;
1bdc94
     Visitor *v;
1bdc94
+    const QDictEntry *e;
1bdc94
     Error *local_err = NULL;
1bdc94
 
1bdc94
     v = qobject_input_visitor_new_flat_confused(options, errp);
1bdc94
@@ -572,6 +573,12 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
1bdc94
         return NULL;
1bdc94
     }
1bdc94
 
1bdc94
+    /* Remove the processed options from the QDict (the visitor processes
1bdc94
+     * _all_ options in the QDict) */
1bdc94
+    while ((e = qdict_first(options))) {
1bdc94
+        qdict_del(options, e->key);
1bdc94
+    }
1bdc94
+
1bdc94
     return opts;
1bdc94
 }
1bdc94
 
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94