Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 688119 - qcow2: qcow2_open doesn't return useful errors
qcow2: qcow2_open doesn't return useful errors
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.1
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Kevin Wolf
Virtualization Bugs
:
Depends On:
Blocks: 698927
  Show dependency treegraph
 
Reported: 2011-03-16 07:39 EDT by Kevin Wolf
Modified: 2013-01-09 18:39 EST (History)
5 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.151.el6
Doc Type: Bug Fix
Doc Text:
Cause: qcow2_open() error handling returned -1 instead of proper error codes. Consequence: -1 interpreted as EPERM by callers, causing misleading error messages. Also, qcow2 images with a version number > 2 should return -ENOTSUP, but they would be detected as raw images. Fix: Add proper -errno error return values to qcow2_open(). Result: when opening qcow2 images, permission errors or unsupported qcow versions are properly reported.
Story Points: ---
Clone Of:
: 698927 (view as bug list)
Environment:
Last Closed: 2011-05-19 07:21:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0534 normal SHIPPED_LIVE Important: qemu-kvm security, bug fix, and enhancement update 2011-05-19 07:20:36 EDT

  None (edit)
Description Kevin Wolf 2011-03-16 07:39:44 EDT
In error cases, qcow2_open usually returns -1, which is interpreted as EPERM by callers and may cause misleading error messages. Also, qcow2 images with a version number > 2 should return -ENOTSUP, but they really are detected as raw images.

These situations happen when an I/O error occurs during qcow2_open or the header is modified to contain values that qemu can't handle today. This may be by a future version of qemu or manually with a hex editor.
Comment 2 juzhang 2011-03-17 06:58:56 EDT
Can reproduce this issue with qemu-kvm-0.12.1.2-2.149.el6.x86_64.
step
1.create qcow2 image.
#qemu-img create -f qcow2 test.qcow2 1G
Formatting 'test.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=0

2.check qcow2 info
qemu-img info test.qcow2
image: test.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 136K
cluster_size: 65536

3.hack qcow2 file,using 3 instead of 2
4.recheck qcow2 info
qemu-img info test.qcow2
image: test.qcow2
file format: raw
virtual size: 256K (262144 bytes)
disk size: 136K

Mark qa_ack+
Comment 6 juzhang 2011-03-30 02:22:06 EDT
Verified using steps as same as comment2 with qemu-kvm-0.12.1.2-2.153.el6.x86_64

after step 4
#qemu-img info test.qcow2
'' uses a qcow2 feature which is not supported by this qemu version: QCOW version 3
qemu-img: Could not open 'test.qcow2'
Comment 7 juzhang 2011-03-30 02:23:51 EDT
According to comment6,set this issue status as verified.
Comment 8 Eduardo Habkost 2011-05-03 15:12:31 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: qcow2_open() error handling returned -1 instead of proper error codes.

Cosequence: -1 interpreted as EPERM by
callers, causing misleading error messages. Also, qcow2 images with a version number > 2 should return -ENOTSUP, but they would be detected as raw images.

Fix: Add proper -errno error return values to qcow2_open().

Result: when opening qcow2 images, permission errors or unsupported qcow versions are properly reported.
Comment 9 Eduardo Habkost 2011-05-03 16:56:18 EDT
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,6 +1,6 @@
 Cause: qcow2_open() error handling returned -1 instead of proper error codes.
 
-Cosequence: -1 interpreted as EPERM by
+Consequence: -1 interpreted as EPERM by
 callers, causing misleading error messages. Also, qcow2 images with a version number > 2 should return -ENOTSUP, but they would be detected as raw images.
 
 Fix: Add proper -errno error return values to qcow2_open().
Comment 10 errata-xmlrpc 2011-05-19 07:21:14 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html
Comment 11 errata-xmlrpc 2011-05-19 09:02:12 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

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