[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/32] qemu-img: Print error if check failed
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 32/32] qemu-img: Print error if check failed |
Date: |
Thu, 23 Oct 2014 22:42:39 +0200 |
From: Max Reitz <address@hidden>
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.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
qemu-img.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 09e7e72..731502c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -687,16 +687,23 @@ static int img_check(int argc, char **argv)
check->corruptions_fixed = corruptions_fixed;
}
- switch (output_format) {
- case OFORMAT_HUMAN:
- dump_human_image_check(check, quiet);
- break;
- case OFORMAT_JSON:
- dump_json_image_check(check, quiet);
- break;
+ if (!ret) {
+ switch (output_format) {
+ case OFORMAT_HUMAN:
+ dump_human_image_check(check, quiet);
+ break;
+ case OFORMAT_JSON:
+ dump_json_image_check(check, quiet);
+ break;
+ }
}
if (ret || check->check_errors) {
+ if (ret) {
+ error_report("Check failed: %s", strerror(-ret));
+ } else {
+ error_report("Check failed");
+ }
ret = 1;
goto fail;
}
--
1.8.3.1
- [Qemu-devel] [PULL 22/32] iotests: Add test for potentially damaging repairs, (continued)
- [Qemu-devel] [PULL 22/32] iotests: Add test for potentially damaging repairs, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 23/32] qcow2: Drop REFCOUNT_SHIFT, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 24/32] docs/qcow2: Correct refcount_block_entries, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 25/32] docs/qcow2: Limit refcount_order to [0, 6], Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 27/32] qemu-io: Respect early image end for map, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 28/32] iotests: Add test for map commands, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 30/32] iotests: Add test for qcow2 L1 table update, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 29/32] qcow2: Do not overflow when writing an L1 sector, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 26/32] block: Respect underlying file's EOF, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 31/32] block: char devices on FreeBSD are not behind a pager, Kevin Wolf, 2014/10/23
- [Qemu-devel] [PULL 32/32] qemu-img: Print error if check failed,
Kevin Wolf <=
- Re: [Qemu-devel] [PULL 00/32] Block patches, Peter Maydell, 2014/10/24