From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crTGa-0006sY-Vq for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crTGZ-0001hY-1w for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59464) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1crTGY-0001hD-Sn for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD80A80494 for ; Fri, 24 Mar 2017 17:44:46 +0000 (UTC) From: Markus Armbruster Date: Fri, 24 Mar 2017 18:44:40 +0100 Message-Id: <1490377482-13337-8-git-send-email-armbru@redhat.com> In-Reply-To: <1490377482-13337-1-git-send-email-armbru@redhat.com> References: <1490377482-13337-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH RFC v2 7/9] rbd: Clean up qemu_rbd_create()'s detour through QemuOpts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jdurgin@redhat.com, jcody@redhat.com, kwolf@redhat.com, mreitz@redhat.com, eblake@redhat.com The conversion from QDict to QemuOpts is pointless. Simply get the stuff straight from the QDict. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- block/rbd.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index e8db165..6397626 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -375,7 +375,6 @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) rados_t cluster; rados_ioctx_t io_ctx; QDict *options = NULL; - QemuOpts *rbd_opts = NULL; int ret = 0; secretid = qemu_opt_get(opts, "password-secret"); @@ -406,19 +405,11 @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) goto exit; } - rbd_opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); - qemu_opts_absorb_qdict(rbd_opts, options, &local_err); - if (local_err) { - error_propagate(errp, local_err); - ret = -EINVAL; - goto exit; - } - - pool = qemu_opt_get(rbd_opts, "pool"); - conf = qemu_opt_get(rbd_opts, "conf"); - clientname = qemu_opt_get(rbd_opts, "user"); - name = qemu_opt_get(rbd_opts, "image"); - keypairs = qemu_opt_get(rbd_opts, "=keyvalue-pairs"); + pool = qdict_get_str(options, "pool"); + conf = qdict_get_str(options, "conf"); + clientname = qdict_get_str(options, "user"); + name = qdict_get_str(options, "image"); + keypairs = qdict_get_str(options, "=keyvalue-pairs"); ret = rados_create(&cluster, clientname); if (ret < 0) { @@ -469,7 +460,6 @@ shutdown: exit: QDECREF(options); - qemu_opts_del(rbd_opts); return ret; } -- 2.7.4