[Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow

John Snow posted 1 patch 4 years, 9 months ago
Test docker-clang@ubuntu passed
Test s390x passed
Test asan passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190626215301.30733-1-jsnow@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
block/qcow.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by John Snow 4 years, 9 months ago
Reported-by: radmehrsaeed7@gmail.com
Fixes: https://bugs.launchpad.net/bugs/1832914
Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qcow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/block/qcow.c b/block/qcow.c
index 6dee5bb792..a9cb6ae0bd 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -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;
     }
-- 
2.21.0


Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by Eric Blake 4 years, 9 months ago
On 6/26/19 4:53 PM, John Snow wrote:
> Reported-by: radmehrsaeed7@gmail.com
> Fixes: https://bugs.launchpad.net/bugs/1832914
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qcow.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Yes, this is useful.

Reviewed-by: Eric Blake <eblake@redhat.com>

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)

> 
> diff --git a/block/qcow.c b/block/qcow.c
> index 6dee5bb792..a9cb6ae0bd 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -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;
>      }
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [Qemu-block] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by Maxim Levitsky 4 years, 9 months ago
On Wed, 2019-06-26 at 17:53 -0400, John Snow wrote:
> Reported-by: radmehrsaeed7@gmail.com
> Fixes: https://bugs.launchpad.net/bugs/1832914
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qcow.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/block/qcow.c b/block/qcow.c
> index 6dee5bb792..a9cb6ae0bd 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -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;
>      }

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky


Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by Kevin Wolf 4 years, 9 months ago
Am 26.06.2019 um 23:53 hat John Snow geschrieben:
> Reported-by: radmehrsaeed7@gmail.com
> Fixes: https://bugs.launchpad.net/bugs/1832914
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qcow.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/block/qcow.c b/block/qcow.c
> index 6dee5bb792..a9cb6ae0bd 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -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

Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by Eric Blake 4 years, 9 months ago
On 6/27/19 3:34 AM, Kevin Wolf wrote:
> Am 26.06.2019 um 23:53 hat John Snow geschrieben:
>> Reported-by: radmehrsaeed7@gmail.com
>> Fixes: https://bugs.launchpad.net/bugs/1832914
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>  block/qcow.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/qcow.c b/block/qcow.c
>> index 6dee5bb792..a9cb6ae0bd 100644
>> --- a/block/qcow.c
>> +++ b/block/qcow.c
>> @@ -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.

> Kevin
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by John Snow 4 years, 9 months ago

On 6/27/19 4:34 AM, Kevin Wolf wrote:
> Am 26.06.2019 um 23:53 hat John Snow geschrieben:
>> Reported-by: radmehrsaeed7@gmail.com
>> Fixes: https://bugs.launchpad.net/bugs/1832914
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>  block/qcow.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/qcow.c b/block/qcow.c
>> index 6dee5bb792..a9cb6ae0bd 100644
>> --- a/block/qcow.c
>> +++ b/block/qcow.c
>> @@ -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.

> Kevin
> 

Can a maintainer pretty-please make the edit?

Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by Kevin Wolf 4 years, 9 months ago
Am 27.06.2019 um 19:17 hat John Snow geschrieben:
> 
> 
> On 6/27/19 4:34 AM, Kevin Wolf wrote:
> > Am 26.06.2019 um 23:53 hat John Snow geschrieben:
> >> Reported-by: radmehrsaeed7@gmail.com
> >> Fixes: https://bugs.launchpad.net/bugs/1832914
> >> Signed-off-by: John Snow <jsnow@redhat.com>
> >> ---
> >>  block/qcow.c | 7 ++++++-
> >>  1 file changed, 6 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/block/qcow.c b/block/qcow.c
> >> index 6dee5bb792..a9cb6ae0bd 100644
> >> --- a/block/qcow.c
> >> +++ b/block/qcow.c
> >> @@ -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.
> 
> > Kevin
> 
> Can a maintainer pretty-please make the edit?

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

Kevin

Re: [Qemu-devel] [PATCH] block/qcow: Improve error when opening qcow2 files as qcow
Posted by John Snow 4 years, 9 months ago

On 6/28/19 5:24 AM, Kevin Wolf wrote:
> Am 27.06.2019 um 19:17 hat John Snow geschrieben:
>>
>>
>> On 6/27/19 4:34 AM, Kevin Wolf wrote:
>>> Am 26.06.2019 um 23:53 hat John Snow geschrieben:
>>>> Reported-by: radmehrsaeed7@gmail.com
>>>> Fixes: https://bugs.launchpad.net/bugs/1832914
>>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>>> ---
>>>>  block/qcow.c | 7 ++++++-
>>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/block/qcow.c b/block/qcow.c
>>>> index 6dee5bb792..a9cb6ae0bd 100644
>>>> --- a/block/qcow.c
>>>> +++ b/block/qcow.c
>>>> @@ -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.
>>
>>> Kevin
>>
>> Can a maintainer pretty-please make the edit?
> 
> A maintainer did that now. (read: thanks, applied)
> 
> Kevin
> 

Thankyouthankyou!

--js