Bug 1054753
| Summary: | qemu-img doesn't print error in json for raw images | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Pavel Zhukov <pzhukov> |
| Component: | qemu-kvm | Assignee: | Hanna Czenczek <hreitz> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.6 | CC: | bsarathy, fsimonce, hreitz, juzhang, mkenneth, nobody, qzhang, rbalakri, virt-maint |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | qemu-kvm-0.12.1.2-2.429.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-10-14 06:54:50 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Pavel Zhukov
2014-01-17 12:12:46 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 ~]# 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. 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. Fix included in qemu-kvm-0.12.1.2-2.429.el6 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 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 (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. 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 |