From nobody Mon Feb 9 06:00:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149037759712573.91902657265109; Fri, 24 Mar 2017 10:46:37 -0700 (PDT) Received: from localhost ([::1]:34296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crTIK-0008Fk-2j for importer@patchew.org; Fri, 24 Mar 2017 13:46:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1crTGa-0006sV-Vh for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1crTGZ-0001hq-Bs for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36784) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1crTGZ-0001hO-3X for qemu-devel@nongnu.org; Fri, 24 Mar 2017 13:44:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17F2F3DD47 for ; Fri, 24 Mar 2017 17:44:47 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2C775DD62; Fri, 24 Mar 2017 17:44:46 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8776211385EF; Fri, 24 Mar 2017 18:44:42 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 17F2F3DD47 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 17F2F3DD47 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 24 Mar 2017 18:44:39 +0100 Message-Id: <1490377482-13337-7-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> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 24 Mar 2017 17:44:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC v2 6/9] rbd: Clean up runtime_opts, fix -drive to reject filename X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jdurgin@redhat.com, jcody@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" runtime_opts is used for three different purposes: * qemu_rbd_open() uses it to accept options it recognizes, such as "pool" and "image". Other .bdrv_open() methods do it similarly. * qemu_rbd_open() accepts additional list-valued options auth-supported and server, with the help of qemu_rbd_array_opts(). The list elements are again dictionaries. qemu_rbd_array_opts() uses runtime_opts to accept their members. Thus, runtime_opts contains recognized sub-sub-options "auth", "host", "port" in addition to recognized options. No other block driver does that. * qemu_rbd_create() uses it to convert the QDict produced by qemu_rbd_parse_filename() to QemuOpts. No other block driver does that. The keys produced by qemu_rbd_parse_filename() are "pool", "image", "snapshot", "conf", "user" and "keyvalue-pairs". qemu_rbd_open() accepts these, so no additional ones here. This is a confusing mess. Dates back to commit 0f9d252. First step to clean it up is documenting runtime_opts.desc[]: * Reorder entries to match the QAPI schema, like we do in other block drivers. * Document why the schema's "server" and "auth-supported" aren't in .desc[]. * Document why "keyvalue-pairs", "host", "port" and "auth" are in .desc[], but not the schema. * Delete "filename", because none of the three users actually uses it. This fixes -drive to reject parameter filename instead of silently ignoring it. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- block/rbd.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 2632533..e8db165 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -294,21 +294,6 @@ static QemuOptsList runtime_opts =3D { .head =3D QTAILQ_HEAD_INITIALIZER(runtime_opts.head), .desc =3D { { - .name =3D "filename", - .type =3D QEMU_OPT_STRING, - .help =3D "Specification of the rbd image", - }, - { - .name =3D "password-secret", - .type =3D QEMU_OPT_STRING, - .help =3D "ID of secret providing the password", - }, - { - .name =3D "conf", - .type =3D QEMU_OPT_STRING, - .help =3D "Rados config file location", - }, - { .name =3D "pool", .type =3D QEMU_OPT_STRING, .help =3D "Rados pool name", @@ -319,6 +304,11 @@ static QemuOptsList runtime_opts =3D { .help =3D "Image name in the pool", }, { + .name =3D "conf", + .type =3D QEMU_OPT_STRING, + .help =3D "Rados config file location", + }, + { .name =3D "snapshot", .type =3D QEMU_OPT_STRING, .help =3D "Ceph snapshot name", @@ -329,6 +319,19 @@ static QemuOptsList runtime_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "Rados id name", }, + /* + * server.* and auth-supported.* extracted manually, see + * qemu_rbd_array_opts() + */ + { + .name =3D "password-secret", + .type =3D QEMU_OPT_STRING, + .help =3D "ID of secret providing the password", + }, + /* + * Legacy keys accepted by qemu_rbd_parse_filename(), not in + * the QAPI schema + */ { /* * HACK: name starts with '=3D' so that qemu_opts_parse() @@ -338,6 +341,12 @@ static QemuOptsList runtime_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "Legacy rados key/value option parameters", }, + /* + * The remainder aren't option keys, but option sub-sub-keys, + * so that qemu_rbd_array_opts() can abuse runtime_opts for + * its own purposes + * TODO clean this up + */ { .name =3D "host", .type =3D QEMU_OPT_STRING, --=20 2.7.4