yeahuh / rpms / qemu-kvm

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