From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Peter Lieven" <pl@kamp.de>,
"Benoît Canet" <benoit.canet@nodalink.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Print error if check failed
Date: Thu, 23 Oct 2014 08:07:57 -0600 [thread overview]
Message-ID: <54490BBD.8010006@redhat.com> (raw)
In-Reply-To: <544909A6.2020204@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
On 10/23/2014 07:59 AM, Max Reitz wrote:
> On 2014-10-23 at 15:51, Eric Blake wrote:
>> On 10/23/2014 07:29 AM, Max Reitz wrote:
>>> Currently, if bdrv_check() fails either by returning -errno or having
>>> check_errors set, qemu-img check just exits with 1 after having told the
>>> user that there were no errors on the image. This is bad.
>>>
>>> Instead of printing the check result if there were internal errors which
>>> were so bad that bdrv_check() could not even complete with 0 as a return
>>> value, qemu-img check should inform the user about the error.
>>>
>> Is there a way to exercise this in the testsuite?
>
> It would involve some blkdebug things which try to break the qcow2 check
> function. I wouldn't rely on it, because this rather exercises the qcow2
> check function than this patch.
Fair enough.
>>> + case OFORMAT_JSON:
>>> + dump_json_image_check(check, quiet);
>>> + break;
>>> + }
>>> }
>>> if (ret || check->check_errors) {
>> Can we ever have ret == 0 (so we attempted dump_*_image_check) AND
>> check->check_errors? Will that be confusing output, to have both a
>> (probably incorrect) dump on stdout and an error message on stderr?
>
> Yes, I think we can. I interpreted that as "Test completed, but there
> were errors". The dump should not be incorrect, because if it was, the
> check function should not have returned 0.
>
> Therefore, I think we should dump the test result because by returning 0
> the check function says it's valid. If there were check_errors, the dump
> function will show their number, too.
Furthermore, if 'quiet' is true, then the dump_* call probably output
nothing, but the fact that we want to return non-zero to flag that check
detected problems is worth being noisy about. If I understand
correctly, 'quiet' is only about suppressing stdout, not stderr, and
always being noisy on stderr for non-zero exit is a good idea.
Okay, I think your answers convinced me, and I'm comfortable enough with
the patch as-is to give:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
next prev parent reply other threads:[~2014-10-23 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-23 13:29 [Qemu-devel] [PATCH] qemu-img: Print error if check failed Max Reitz
2014-10-23 13:51 ` Eric Blake
2014-10-23 13:59 ` Max Reitz
2014-10-23 14:07 ` Eric Blake [this message]
2014-10-23 14:11 ` Markus Armbruster
2014-10-23 15:01 ` Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54490BBD.8010006@redhat.com \
--to=eblake@redhat.com \
--cc=benoit.canet@nodalink.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.