From nobody Sun May 5 20:49:18 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517914403404647.7065732136572; Tue, 6 Feb 2018 02:53:23 -0800 (PST) Received: from localhost ([::1]:54571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej0sM-0008IK-Mu for importer@patchew.org; Tue, 06 Feb 2018 05:53:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej0rK-0007jH-VA for qemu-devel@nongnu.org; Tue, 06 Feb 2018 05:52:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej0rK-0000Y9-3l for qemu-devel@nongnu.org; Tue, 06 Feb 2018 05:52:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36020) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej0rD-0000W7-S7; Tue, 06 Feb 2018 05:52:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10FA5624BE; Tue, 6 Feb 2018 10:52:11 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAE7460462; Tue, 6 Feb 2018 10:52:09 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 10:52:04 +0000 Message-Id: <20180206105204.14817-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 06 Feb 2018 10:52:11 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] block: include original filename when reporting invalid URIs 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: Kevin Wolf , Jeff Cody , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Consider passing a JSON based block driver to "qemu-img commit" $ qemu-img commit 'json:{"driver":"qcow2","file":{"driver":"gluster",\ "volume":"gv0","path":"sn1.qcow2", "server":[{"type":\ "tcp","host":"10.73.199.197","port":"24007"}]},}' Currently it will commit the content and then report an incredibly useless error message when trying to re-open the committed image: qemu-img: invalid URI Usage: file=3Dgluster[+transport]://[host[:port]]volume/path[?socket=3D..= .][,file.debug=3DN][,file.logfile=3D/path/filename.log] With this fix we get: qemu-img: invalid URI json:{"server.0.host": "10.73.199.197", "driver": "gluster", "path": "luks.qcow2", "server.0.type": "tcp", "server.0.port": "24007", "volume": "gv0"} Of course the root cause problem still exists, but now we know what actually needs fixing. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake --- block/gluster.c | 2 +- block/sheepdog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index 0f4265a3a4..0215e19087 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -660,7 +660,7 @@ static struct glfs *qemu_gluster_init(BlockdevOptionsGl= uster *gconf, if (filename) { ret =3D qemu_gluster_parse_uri(gconf, filename); if (ret < 0) { - error_setg(errp, "invalid URI"); + error_setg(errp, "invalid URI %s", filename); error_append_hint(errp, "Usage: file=3Dgluster[+transport]://" "[host[:port]]volume/path[?socket=3D..= .]" "[,file.debug=3DN]" diff --git a/block/sheepdog.c b/block/sheepdog.c index f684477328..c847ab6c98 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1050,7 +1050,7 @@ static void sd_parse_uri(SheepdogConfig *cfg, const c= har *filename, =20 cfg->uri =3D uri =3D uri_parse(filename); if (!uri) { - error_setg(&err, "invalid URI"); + error_setg(&err, "invalid URI '%s'", filename); goto out; } =20 --=20 2.14.3