block/qcow: Improve error when opening qcow2 files as qcow
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
@@ -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
Quoted 6 lines · John Snow
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- 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@@ -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
Am 26.06.2019 um 23:53 hat John Snow geschrieben:
Quoted 12 lines
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- block/qcow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)block/qcow.c +0
-0
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
Quoted 8 lines · Kevin Wolf
Am 26.06.2019 um 23:53 hat John Snow geschrieben:
Quoted 7 lines
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- 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@@ -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
Quoted 8 lines · Kevin Wolf
Am 26.06.2019 um 23:53 hat John Snow geschrieben:
Quoted 7 lines
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- 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@@ -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?
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
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- 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@@ -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
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
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- 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@@ -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
Quoted 15 lines · John Snow
Reported-by [email protected]Signed-off-by John Snow <[email protected]>--- block/qcow.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)block/qcow.c +0
-0@@ -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