Skip to contentSkip to conversation

block/qcow: Improve error when opening qcow2 files as qcow

PATCH In review John Snow 4 participants 8 messages Jun 26, 2019 – Jun 28, 2019 Block layer

lore
Share & tools
lore

John Snow

author
#0 lore raw

PATCH 1/1 block/qcow: Improve error when opening qcow2 files as qcow

---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
block/qcow.c +6 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");
+        }
+
         ret = -ENOTSUP;
         goto fail;
     }
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · John Snow
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Yes, this is useful.

Reminds me of when I helped convince the file(1) database maintainers that 'qcow2 (v3)' was better than 'qcow (v3)'.
(https://bugzilla.redhat.com/show_bug.cgi?id=1654349, file.git 60b896d4)

Quoted 20 lines
block/qcow.c +6 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");
+        }
+
         ret = -ENOTSUP;
         goto fail;
     }
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#2 lore raw
In reply to John Snow

Am 26.06.2019 um 23:53 hat John Snow geschrieben:

Quoted 12 lines
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
block/qcow.c +0 -0
index 6dee5bb792..a9cb6ae0bd 100644

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 162

Quoted 8 lines
block/qcow.c +4 -1
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");

I think we want a \n at the end here.

Kevin

#3 lore raw
Quoted 8 lines · Kevin Wolf

Am 26.06.2019 um 23:53 hat John Snow geschrieben:

Quoted 7 lines
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 16 lines

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 162

Quoted 13 lines
block/qcow.c +4 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");

I think we want a \n at the end here.

Yes, we do. Good spot.

Quoted 3 lines

Kevin

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
author
#4 lore raw
In reply to Kevin Wolf
Quoted 8 lines · Kevin Wolf

Am 26.06.2019 um 23:53 hat John Snow geschrieben:

Quoted 7 lines
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 16 lines

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 162

Quoted 13 lines
block/qcow.c +4 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");

I think we want a \n at the end here.

D'oh.

Quoted 2 lines

Kevin

Can a maintainer pretty-please make the edit?

#5 lore raw

Am 27.06.2019 um 19:17 hat John Snow geschrieben:

Quoted 28 lines · Kevin Wolf
Quoted 8 lines

Am 26.06.2019 um 23:53 hat John Snow geschrieben:

Quoted 7 lines
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 16 lines

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 162

Quoted 13 lines
block/qcow.c +4 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");

I think we want a \n at the end here.

Quoted 5 lines

D'oh.

Quoted 1 line

Kevin

Can a maintainer pretty-please make the edit?

A maintainer did that now. (read: thanks, applied)

Kevin

author
#6 lore raw
Quoted 31 lines · Kevin Wolf

Am 27.06.2019 um 19:17 hat John Snow geschrieben:

Quoted 30 lines · Kevin Wolf
Quoted 8 lines

Am 26.06.2019 um 23:53 hat John Snow geschrieben:

Quoted 7 lines
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 16 lines

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 162

Quoted 13 lines
block/qcow.c +4 -1
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");

I think we want a \n at the end here.

D'oh.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Kevin

Can a maintainer pretty-please make the edit?

A maintainer did that now. (read: thanks, applied)

Kevin

Thankyouthankyou!

--js

Reviewed-by on v1 1/1
#7 lore raw
In reply to John Snow
Quoted 15 lines · John Snow
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
block/qcow.c +0 -0
index 6dee5bb792..a9cb6ae0bd 100644
@@ -156,7 +156,12 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail;
     }
     if (header.version != QCOW_VERSION) {

block/qcow.c static int qcow_open(BlockDriverState *bs, QDict *options, int flags, · line 167

Quoted 10 lines
block/qcow.c +6 -1
-        error_setg(errp, "Unsupported qcow version %" PRIu32, header.version);
+        error_setg(errp, "qcow (v%d) does not support qcow version %" PRIu32,
+                   QCOW_VERSION, header.version);
+        if (header.version == 2 || header.version == 3) {
+            error_append_hint(errp, "Try the 'qcow2' driver instead.");
+        }
+
         ret = -ENOTSUP;
         goto fail;
     }

Best regards,
Maxim Levitsky