]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qemu-img: Report error even with --oformat=json
authorMax Reitz <mreitz@redhat.com>
Sat, 31 May 2014 19:33:30 +0000 (21:33 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 2 Jun 2014 11:58:40 +0000 (13:58 +0200)
img_check() should report that the format of the given image does not
support checks even if JSON output is desired. JSON data is output to
stdout, as opposed to error messages, which are (in the case of
qemu-img) printed to stderr. Therefore, it is easy to distinguish
between the two.

Also, img_info() does already use error_report() for human-readable
messages even though JSON output is desired (through
collect_image_info_list()).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-img.c

index d118da5c2fa74a01916f731898c72763d1929cbf..b3d2bc6f024663fa6a0e652286c857681f29c41f 100644 (file)
@@ -663,9 +663,7 @@ static int img_check(int argc, char **argv)
     ret = collect_image_check(bs, check, filename, fmt, fix);
 
     if (ret == -ENOTSUP) {
-        if (output_format == OFORMAT_HUMAN) {
-            error_report("This image format does not support checks");
-        }
+        error_report("This image format does not support checks");
         ret = 63;
         goto fail;
     }