From nobody Mon May 6 23:33:32 2024 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.zohomail.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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522753795001308.2676040859358; Tue, 3 Apr 2018 04:09:55 -0700 (PDT) Received: from localhost ([::1]:53214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3Jov-0004Qk-HN for importer@patchew.org; Tue, 03 Apr 2018 07:09:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3Jnq-0003wJ-8F for qemu-devel@nongnu.org; Tue, 03 Apr 2018 07:08:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3Jnk-00040C-Kd for qemu-devel@nongnu.org; Tue, 03 Apr 2018 07:08:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33490 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f3Jnc-0003sg-Cf; Tue, 03 Apr 2018 07:08:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE0A4BD95; Tue, 3 Apr 2018 11:08:19 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.118.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D9467C26; Tue, 3 Apr 2018 11:08:13 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 3 Apr 2018 13:08:10 +0200 Message-Id: <20180403110810.25624-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 03 Apr 2018 11:08:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 03 Apr 2018 11:08:19 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12] gluster: Fix blockdev-add with server.N.type=unix 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, prasanna.kalever@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, 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" The legacy command line interface gets the socket path from an option called 'socket'. QAPI in contract uses SocketAddress, where the corresponding option is called 'path'. Fix the gluster block driver to accept both 'socket' and 'path', with 'path' being the preferred syntax. https://bugzilla.redhat.com/show_bug.cgi?id=3D1545155 Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/gluster.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index 296e036b3d..4adc1a875b 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -167,7 +167,12 @@ static QemuOptsList runtime_unix_opts =3D { { .name =3D GLUSTER_OPT_SOCKET, .type =3D QEMU_OPT_STRING, - .help =3D "socket file path)", + .help =3D "socket file path (legacy)", + }, + { + .name =3D GLUSTER_OPT_PATH, + .type =3D QEMU_OPT_STRING, + .help =3D "socket file path (QAPI)", }, { /* end of list */ } }, @@ -615,10 +620,18 @@ static int qemu_gluster_parse_json(BlockdevOptionsGlu= ster *gconf, goto out; } =20 - ptr =3D qemu_opt_get(opts, GLUSTER_OPT_SOCKET); + ptr =3D qemu_opt_get(opts, GLUSTER_OPT_PATH); + if (!ptr) { + ptr =3D qemu_opt_get(opts, GLUSTER_OPT_SOCKET); + } else if (qemu_opt_get(opts, GLUSTER_OPT_SOCKET)) { + error_setg(&local_err, + "Conflicting parameters 'path' and 'socket'"); + error_append_hint(&local_err, GERR_INDEX_HINT, i); + goto out; + } if (!ptr) { error_setg(&local_err, QERR_MISSING_PARAMETER, - GLUSTER_OPT_SOCKET); + GLUSTER_OPT_PATH); error_append_hint(&local_err, GERR_INDEX_HINT, i); goto out; } @@ -684,7 +697,7 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *g= conf, "file.server.0.host=3D1.2.3.4," "file.server.0.port=3D24007," "file.server.1.transport=3Dunix," - "file.server.1.socket=3D/var/run/glusterd.soc= ket ..." + "file.server.1.path=3D/var/run/glusterd.socke= t ..." "\n"); return ret; } --=20 2.13.6