Bug 980771 - [RFE] qemu-img should be able to tell the compat version of a qcow2 image
[RFE] qemu-img should be able to tell the compat version of a qcow2 image
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Max Reitz
Virtualization Bugs
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-03 04:18 EDT by Sibiao Luo
Modified: 2014-06-17 23:30 EDT (History)
11 users (show)

See Also:
Fixed In Version: qemu-kvm-1.5.3-16.el7
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 09:27:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sibiao Luo 2013-07-03 04:18:15 EDT
Description of problem:
As we know that we create a qcow2/qcow3 image, but it is hard to tell difference from it was qcow2 or qcow3 that we have to look at the image file header var a qcow2.py script. We can add compat=1.1 or other info to 'qemu-img info xxx' that is a easier and convenient method for users.

Version-Release number of selected component (if applicable):
host info:
3.10.0-0.rc7.64.el7.x86_64
qemu-kvm-1.5.1-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.create a qcow3 image and check the info.
# qemu-img create -f qcow2 -o compat=1.1 sluo.qcow3 1G
Formatting 'sluo.qcow3', fmt=qcow2 size=1073741824 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=off
# qemu-img info sluo.qcow3 
image: sluo.qcow3
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 136K
cluster_size: 65536
2.create a qcow2 image and check the info.
# qemu-img create -f qcow2 sluo.qcow2 1G
Formatting 'sluo.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off
# qemu-img info sluo.qcow2
image: sluo.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 136K
cluster_size: 65536
3.look at the image file header.
# python /root/qemu/tests/qemu-iotests/qcow2.py sluo.qcow3 dump-header
magic                     0x514649fb
version                   3                     <----------------qcow3
backing_file_offset       0x0
backing_file_size         0x0
cluster_bits              16
size                      1073741824
crypt_method              0
l1_size                   2
l1_table_offset           0x30000
refcount_table_offset     0x10000
refcount_table_clusters   1
nb_snapshots              0
snapshot_offset           0x0
incompatible_features     0x0
compatible_features       0x0
autoclear_features        0x0
refcount_order            4
header_length             104

# python /root/qemu/tests/qemu-iotests/qcow2.py sluo.qcow2 dump-header
magic                     0x514649fb
version                   2                     <----------------qcow3
backing_file_offset       0x0
backing_file_size         0x0
cluster_bits              16
size                      1073741824
crypt_method              0
l1_size                   2
l1_table_offset           0x30000
refcount_table_offset     0x10000
refcount_table_clusters   1
nb_snapshots              0
snapshot_offset           0x0
incompatible_features     0x0
compatible_features       0x0
autoclear_features        0x0
refcount_order            4
header_length             72

Actual results:


Expected results:
We can add compat=1.1 and other info(e.g: version ) to 'qemu-img info xxx' that is a easier and convenient method for users.

Additional info:
Comment 1 Sibiao Luo 2013-07-03 04:21:56 EDT
(In reply to Sibiao Luo from comment #0)
> 3.look at the image file header.
> # python /root/qemu/tests/qemu-iotests/qcow2.py sluo.qcow3 dump-header
> magic                     0x514649fb
> version                   3                     <----------------qcow3
> backing_file_offset       0x0
> backing_file_size         0x0
> cluster_bits              16
> size                      1073741824
> crypt_method              0
> l1_size                   2
> l1_table_offset           0x30000
> refcount_table_offset     0x10000
> refcount_table_clusters   1
> nb_snapshots              0
> snapshot_offset           0x0
> incompatible_features     0x0
> compatible_features       0x0
> autoclear_features        0x0
> refcount_order            4
> header_length             104
> 
> # python /root/qemu/tests/qemu-iotests/qcow2.py sluo.qcow2 dump-header
> magic                     0x514649fb
> version                   2                     <----------------qcow3
  version                   2                     <----------------qcow2
> backing_file_offset       0x0
> backing_file_size         0x0
> cluster_bits              16
> size                      1073741824
> crypt_method              0
> l1_size                   2
> l1_table_offset           0x30000
> refcount_table_offset     0x10000
> refcount_table_clusters   1
> nb_snapshots              0
> snapshot_offset           0x0
> incompatible_features     0x0
> compatible_features       0x0
> autoclear_features        0x0
> refcount_order            4
> header_length             72
> 
> Actual results:
# python qcow2.py sluo.qcow3 dump-header | grep version
version                   3
# python qcow2.py sluo.qcow2 dump-header | grep version
version                   2
Comment 2 Huang Wenlong 2013-07-03 04:25:25 EDT
If this bug can be fixed ,please also add lazy_refcounts info ,thanks very much
Comment 3 Ademar Reis 2013-09-03 17:49:00 EDT
There's no qcow3 image format. It's still qcow2, but with some extra features enabled when it's created with compat=1.1.

Nevertheless, this bug is valid: qemu-img should be able to tell the user what's the compat version of a qcow2 image.
Comment 5 Miroslav Rezanina 2013-11-07 09:25:38 EST
Fix included in qemu-kvm-1.5.3-16.el7
Comment 7 Sibiao Luo 2013-11-25 22:15:16 EST
Verify this issue on qemu-kvm-1.5.3-19.el7.x86_64 that qemu-img is able to tell the compat version of a qcow2 image successfully.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-50.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64

Steps and results:
# qemu-img create -f qcow2 -o compat=1.1 sluo.qcow3 1G
Formatting 'sluo.qcow3', fmt=qcow2 size=1073741824 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=off 
# qemu-img info sluo.qcow3
image: sluo.qcow3
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 136K
cluster_size: 65536
Format specific information:
    compat: 1.1             <--------------------
    lazy refcounts: false

# qemu-img create -f qcow2 sluo.qcow2 1G
Formatting 'sluo.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off 
# qemu-img info sluo.qcow2
image: sluo.qcow2
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 136K
cluster_size: 65536
Format specific information:
    compat: 0.10             <--------------------

Best Regards,
sluo
Comment 8 Ludek Smid 2014-06-13 09:27:56 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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