|
|
357786 |
From 0b239ab1df3f430f6d1163dc9571e89b99939812 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
Date: Wed, 12 Sep 2018 13:45:42 +0200
|
|
|
357786 |
Subject: [PATCH 03/49] block/rbd: pull out qemu_rbd_convert_options
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
Message-id: <695a2a1c89a6bfd5076d050f5396aa7937e00cc5.1536759805.git.jcody@redhat.com>
|
|
|
357786 |
Patchwork-id: 82143
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 1/3] block/rbd: pull out qemu_rbd_convert_options
|
|
|
357786 |
Bugzilla: 1610605
|
|
|
357786 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
Code movement to pull the conversion from Qdict to BlockdevOptionsRbd
|
|
|
357786 |
into a helper function.
|
|
|
357786 |
|
|
|
357786 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
Message-id: 5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@redhat.com
|
|
|
357786 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
(cherry picked from commit 862e99966b5b59c107255fa806af40cf00ecacec)
|
|
|
357786 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
block/rbd.c | 36 ++++++++++++++++++++++++------------
|
|
|
357786 |
1 file changed, 24 insertions(+), 12 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/block/rbd.c b/block/rbd.c
|
|
|
357786 |
index b93046b..1e4d339 100644
|
|
|
357786 |
--- a/block/rbd.c
|
|
|
357786 |
+++ b/block/rbd.c
|
|
|
357786 |
@@ -648,12 +648,34 @@ failed_opts:
|
|
|
357786 |
return r;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
+static int qemu_rbd_convert_options(QDict *options, BlockdevOptionsRbd **opts,
|
|
|
357786 |
+ Error **errp)
|
|
|
357786 |
+{
|
|
|
357786 |
+ Visitor *v;
|
|
|
357786 |
+ Error *local_err = NULL;
|
|
|
357786 |
+
|
|
|
357786 |
+ /* Convert the remaining options into a QAPI object */
|
|
|
357786 |
+ v = qobject_input_visitor_new_flat_confused(options, errp);
|
|
|
357786 |
+ if (!v) {
|
|
|
357786 |
+ return -EINVAL;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ visit_type_BlockdevOptionsRbd(v, NULL, opts, &local_err);
|
|
|
357786 |
+ visit_free(v);
|
|
|
357786 |
+
|
|
|
357786 |
+ if (local_err) {
|
|
|
357786 |
+ error_propagate(errp, local_err);
|
|
|
357786 |
+ return -EINVAL;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ return 0;
|
|
|
357786 |
+}
|
|
|
357786 |
+
|
|
|
357786 |
static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
357786 |
Error **errp)
|
|
|
357786 |
{
|
|
|
357786 |
BDRVRBDState *s = bs->opaque;
|
|
|
357786 |
BlockdevOptionsRbd *opts = NULL;
|
|
|
357786 |
- Visitor *v;
|
|
|
357786 |
const QDictEntry *e;
|
|
|
357786 |
Error *local_err = NULL;
|
|
|
357786 |
char *keypairs, *secretid;
|
|
|
357786 |
@@ -669,19 +691,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
357786 |
qdict_del(options, "password-secret");
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
- /* Convert the remaining options into a QAPI object */
|
|
|
357786 |
- v = qobject_input_visitor_new_flat_confused(options, errp);
|
|
|
357786 |
- if (!v) {
|
|
|
357786 |
- r = -EINVAL;
|
|
|
357786 |
- goto out;
|
|
|
357786 |
- }
|
|
|
357786 |
-
|
|
|
357786 |
- visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err);
|
|
|
357786 |
- visit_free(v);
|
|
|
357786 |
-
|
|
|
357786 |
+ r = qemu_rbd_convert_options(options, &opts, &local_err);
|
|
|
357786 |
if (local_err) {
|
|
|
357786 |
error_propagate(errp, local_err);
|
|
|
357786 |
- r = -EINVAL;
|
|
|
357786 |
goto out;
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|