From nobody Mon Feb 9 07:25:37 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 1488222359594260.81682502657793; Mon, 27 Feb 2017 11:05:59 -0800 (PST) Received: from localhost ([::1]:55860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciQcM-0002BZ-4e for importer@patchew.org; Mon, 27 Feb 2017 14:05:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciQVh-0005FG-0U for qemu-devel@nongnu.org; Mon, 27 Feb 2017 13:59:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciQVg-0003Gi-4f for qemu-devel@nongnu.org; Mon, 27 Feb 2017 13:59:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52958) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciQVd-0003Ct-Mt; Mon, 27 Feb 2017 13:58:57 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD2DC61BA9; Mon, 27 Feb 2017 18:58:57 +0000 (UTC) Received: from localhost (ovpn-116-95.phx2.redhat.com [10.3.116.95]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1RIwumN019460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 27 Feb 2017 13:58:57 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Mon, 27 Feb 2017 13:58:48 -0500 Message-Id: <12a16b28300f871052a49897ec7875a082fc63e3.1488220970.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 27 Feb 2017 18:58:57 +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 v2 5/5] block/rbd: add support for 'mon_host', 'auth_supported' via QAPI 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: armbru@redhat.com, qemu-block@nongnu.org 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" This adds support for two additional options that may be specified by QAPI in blockdev-add: mon_host: servername and port auth_supported: either 'cephx' or 'none' Signed-off-by: Jeff Cody --- block/rbd.c | 39 +++++++++++++++++++++++++++++++++++++++ qapi/block-core.json | 8 ++++++++ 2 files changed, 47 insertions(+) diff --git a/block/rbd.c b/block/rbd.c index e04a5e1..51e971e 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -394,6 +394,18 @@ static QemuOptsList runtime_opts =3D { .name =3D "keyvalue-pairs", .type =3D QEMU_OPT_STRING, }, + { + .name =3D "server.host", + .type =3D QEMU_OPT_STRING, + }, + { + .name =3D "server.port", + .type =3D QEMU_OPT_STRING, + }, + { + .name =3D "auth_supported", + .type =3D QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -559,6 +571,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *o= ptions, int flags, { BDRVRBDState *s =3D bs->opaque; const char *pool, *snap, *conf, *clientname, *name, *keypairs; + const char *host, *port, *auth_supported; const char *secretid; QemuOpts *opts; Error *local_err =3D NULL; @@ -580,6 +593,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *o= ptions, int flags, clientname =3D qemu_opt_get(opts, "user"); name =3D qemu_opt_get(opts, "image"); keypairs =3D qemu_opt_get(opts, "keyvalue-pairs"); + host =3D qemu_opt_get(opts, "server.host"); + port =3D qemu_opt_get(opts, "server.port"); + auth_supported =3D qemu_opt_get(opts, "auth_supported"); =20 r =3D rados_create(&s->cluster, clientname); if (r < 0) { @@ -604,6 +620,29 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *= options, int flags, goto failed_shutdown; } =20 + /* if mon_host was specified */ + if (host) { + const char *hostname =3D host; + char *mon_host =3D NULL; + + if (port) { + mon_host =3D g_strdup_printf("%s:%s", host, port); + hostname =3D mon_host; + } + r =3D rados_conf_set(s->cluster, "mon_host", hostname); + g_free(mon_host); + if (r < 0) { + goto failed_shutdown; + } + } + + if (auth_supported) { + r =3D rados_conf_set(s->cluster, "auth_supported", auth_supported); + if (r < 0) { + goto failed_shutdown; + } + } + if (qemu_rbd_set_auth(s->cluster, secretid, errp) < 0) { r =3D -EIO; goto failed_shutdown; diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b311ff..376512c 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2680,6 +2680,12 @@ # # @user: #optional Ceph id name. # +# @server: #optional Monitor host address and port. This maps +# to the "mon_host" Ceph option. +# +# @auth_supported: #optional Authentication supported. +# Either "cephx" or"none". +# # @password-secret: #optional The ID of a QCryptoSecret object providing # the password for the login. # @@ -2691,6 +2697,8 @@ '*conf': 'str', '*snapshot': 'str', '*user': 'str', + '*server': 'InetSocketAddress', + '*auth_supported': 'str', '*password-secret': 'str' } } =20 ## --=20 2.9.3