RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1054753 - qemu-img doesn't print error in json for raw images
Summary: qemu-img doesn't print error in json for raw images
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Hanna Czenczek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-17 12:12 UTC by Pavel Zhukov
Modified: 2014-10-14 06:54 UTC (History)
9 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.429.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-14 06:54:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1490 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2014-10-14 01:28:27 UTC

Description Pavel Zhukov 2014-01-17 12:12:46 UTC
Description of problem:
qemu-img check doesn't print error in json format if qcow header was corrupted

Version-Release number of selected component (if applicable):
qemu-img-rhev-0.12.1.2-2.415.el6.3.x86_64

How reproducible:
100%

Steps to Reproduce:
1. qemu-img create -f qcow image
2. dd if=/dev/zero of=image bs=1M count = 10
3. qemu-img check --format=json image

Actual results
Empty output

Expected results:
Error "image doesn't support checks" in JSON

Comment 2 Qunfang Zhang 2014-04-10 09:35:59 UTC
Reproduced on qemu-kvm-rhev-0.12.1.2-2.415.el6_5.7.x86_64:

[root@t1 ~]# qemu-img create -f qcow image 1G
Formatting 'image', fmt=qcow size=1073741824 encryption=off 
[root@t1 ~]# 
[root@t1 ~]# dd if=/dev/zero of=image bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0165179 s, 635 MB/s
[root@t1 ~]# 
[root@t1 ~]# 
[root@t1 ~]# qemu-img check --output=json image
[root@t1 ~]#

Comment 3 Hanna Czenczek 2014-05-05 16:51:39 UTC
I am not sure whether this is truly a bug, as the current implementation deliberately only outputs this error message (which is human-readable) if human-readable output is desired.

Considering that the error message is written to stderr instead of stdout, I do not really see the problem in outputting a raw message instead of proper JSON, either.

Or, as a third option, we could output a proper JSON-formatted error message, but I think this is probably overkill.

Thus, I'd like an opinion of the original author, Federico Simoncelli.

Comment 4 Hanna Czenczek 2014-06-14 20:50:30 UTC
I sent a patch upstream which makes qemu-img always emit an error, regardless of the desired output format and it has been merged as 55d492d7602c27cabb605f42e72c755de1c186c1. I'll backport it.

Comment 6 Miroslav Rezanina 2014-07-04 07:10:22 UTC
Fix included in qemu-kvm-0.12.1.2-2.429.el6

Comment 8 Qunfang Zhang 2014-07-10 06:19:23 UTC
Verified on qemu-kvm-0.12.1.2-2.430.el6:

[root@localhost ~]# qemu-img create -f qcow image 1G
Formatting 'image', fmt=qcow size=1073741824 encryption=off 
[root@localhost ~]# 
[root@localhost ~]# dd if=/dev/zero of=image bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0089412 s, 1.2 GB/s
[root@localhost ~]# 
[root@localhost ~]# qemu-img check --output=json image
This image format does not support checks

Hi, Max
Maybe this is a raw error message instead of json format? According to comment 3, this should be the expected result? 

Thanks,
Qunfang

Comment 9 Hanna Czenczek 2014-07-11 20:21:55 UTC
Hi Qunfang,

Yes, the error message is human-readable, not in JSON format.

This is intentional; as far as I know, every error message emitted by qemu-img is in raw format (even in JSON mode), so doing things differently here would have required to change all those places (for no good reason, in my opinion).

Also, the error message is written to stderr instead of stdout, so a JSON parser listening on stdout will not be confused.


Max

Comment 10 Qunfang Zhang 2014-07-14 02:54:28 UTC
(In reply to Max Reitz from comment #9)
> Hi Qunfang,
> 
> Yes, the error message is human-readable, not in JSON format.
> 
> This is intentional; as far as I know, every error message emitted by
> qemu-img is in raw format (even in JSON mode), so doing things differently
> here would have required to change all those places (for no good reason, in
> my opinion).
> 
> Also, the error message is written to stderr instead of stdout, so a JSON
> parser listening on stdout will not be confused.
> 
> 
> Max

Thanks Max for the explanation.

Comment 11 errata-xmlrpc 2014-10-14 06:54:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1490.html


Note You need to log in before you can comment on or make changes to this bug.