From patchwork Tue Mar 13 12:29:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 10278541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FC09602BD for ; Tue, 13 Mar 2018 12:32:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07A3628952 for ; Tue, 13 Mar 2018 12:32:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9809928FE0; Tue, 13 Mar 2018 12:32:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFEBD28897 for ; Tue, 13 Mar 2018 12:32:44 +0000 (UTC) Received: from localhost ([::1]:39616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evj6i-0006kZ-3j for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Mar 2018 08:32:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evj47-0004Td-0k for qemu-devel@nongnu.org; Tue, 13 Mar 2018 08:30:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evj46-0003mL-4c for qemu-devel@nongnu.org; Tue, 13 Mar 2018 08:30:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43952 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 1evj42-0003kb-KI; Tue, 13 Mar 2018 08:29:58 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3662884222; Tue, 13 Mar 2018 12:29:58 +0000 (UTC) Received: from localhost (ovpn-121-230.rdu2.redhat.com [10.10.121.230]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C106D2166BDA; Tue, 13 Mar 2018 12:29:57 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Tue, 13 Mar 2018 08:29:56 -0400 Message-Id: <20180313122956.21442-2-jcody@redhat.com> In-Reply-To: <20180313122956.21442-1-jcody@redhat.com> References: <20180313122956.21442-1-jcody@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Mar 2018 12:29:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Mar 2018 12:29:58 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jcody@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] [PULL 1/1] 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: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel P. Berrangé 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=gluster[+transport]://[host[:port]]volume/path[?socket=...][,file.debug=N][,file.logfile=/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é Reviewed-by: Eric Blake Message-id: 20180206105204.14817-1-berrange@redhat.com Signed-off-by: Jeff Cody --- 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 63d3c37d4c..296e036b3d 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -665,7 +665,7 @@ static int qemu_gluster_parse(BlockdevOptionsGluster *gconf, if (filename) { ret = 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=gluster[+transport]://" "[host[:port]]volume/path[?socket=...]" "[,file.debug=N]" diff --git a/block/sheepdog.c b/block/sheepdog.c index 8680b2926f..797ea5953b 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1036,7 +1036,7 @@ static void sd_parse_uri(SheepdogConfig *cfg, const char *filename, cfg->uri = uri = uri_parse(filename); if (!uri) { - error_setg(&err, "invalid URI"); + error_setg(&err, "invalid URI '%s'", filename); goto out; }