* [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs
@ 2018-02-06 10:52 Daniel P. Berrangé
2018-02-06 15:09 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2018-02-06 10:52 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Jeff Cody, Kevin Wolf, Max Reitz,
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é <berrange@redhat.com>
---
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(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 f684477328..c847ab6c98 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1050,7 +1050,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;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs
2018-02-06 10:52 [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs Daniel P. Berrangé
@ 2018-02-06 15:09 ` Eric Blake
2018-03-06 10:07 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-03-07 3:16 ` [Qemu-devel] " Jeff Cody
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-02-06 15:09 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel
Cc: Kevin Wolf, Jeff Cody, qemu-block, Max Reitz
On 02/06/2018 04:52 AM, Daniel P. Berrangé wrote:
> 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é <berrange@redhat.com>
> ---
> block/gluster.c | 2 +-
> block/sheepdog.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PATCH] block: include original filename when reporting invalid URIs
2018-02-06 10:52 [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs Daniel P. Berrangé
2018-02-06 15:09 ` Eric Blake
@ 2018-03-06 10:07 ` Stefan Hajnoczi
2018-03-07 3:16 ` [Qemu-devel] " Jeff Cody
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2018-03-06 10:07 UTC (permalink / raw)
To: Jeff Cody; +Cc: qemu-devel, Kevin Wolf, qemu-block, Max Reitz, Daniel Berrange
[-- Attachment #1: Type: text/plain, Size: 2333 bytes --]
On Tue, Feb 06, 2018 at 10:52:04AM +0000, Daniel P. Berrangé wrote:
> 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é <berrange@redhat.com>
> ---
> block/gluster.c | 2 +-
> block/sheepdog.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Jeff: Ping
> 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(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 f684477328..c847ab6c98 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1050,7 +1050,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;
> }
>
> --
> 2.14.3
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs
2018-02-06 10:52 [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs Daniel P. Berrangé
2018-02-06 15:09 ` Eric Blake
2018-03-06 10:07 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
@ 2018-03-07 3:16 ` Jeff Cody
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Cody @ 2018-03-07 3:16 UTC (permalink / raw)
To: Daniel P. Berrangé; +Cc: qemu-devel, qemu-block, Kevin Wolf, Max Reitz
On Tue, Feb 06, 2018 at 10:52:04AM +0000, Daniel P. Berrangé wrote:
> 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é <berrange@redhat.com>
> ---
> 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(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 f684477328..c847ab6c98 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1050,7 +1050,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;
> }
>
> --
> 2.14.3
>
Thanks,
Applied to my block branch:
git://github.com/codyprime/qemu-kvm-jtc block
-Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-07 3:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 10:52 [Qemu-devel] [PATCH] block: include original filename when reporting invalid URIs Daniel P. Berrangé
2018-02-06 15:09 ` Eric Blake
2018-03-06 10:07 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-03-07 3:16 ` [Qemu-devel] " Jeff Cody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).