Bug 997977 - Always specify the compat level for qcow2 if qemu-img allows it
Always specify the compat level for qcow2 if qemu-img allows it
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Ján Tomko
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-16 12:25 EDT by Ján Tomko
Modified: 2014-06-17 20:53 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.1.1-4.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 06:57:27 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 Ján Tomko 2013-08-16 12:25:53 EDT
There are plans to switch the QEMU default for the QCOW2 format from v2 (compat=0.10) to v3 (compat=1.1).

Let libvirt users decide which format they want by always specifying the compat level (if understood by qemu-img) and providing an option in qemu.conf to adjust the default.
Comment 2 Ján Tomko 2013-08-23 07:32:12 EDT
Upstream discussion:
https://www.redhat.com/archives/libvir-list/2013-August/msg00921.html

Upstream patch always specifying the compat level (default is hard-coded to 0.10):
https://www.redhat.com/archives/libvir-list/2013-August/msg01253.html
Comment 3 Ján Tomko 2013-08-28 05:00:18 EDT
Now pushed upstream:
commit bab2eda6ada1bf832decdc64cc5062e54eb105df
Author:     Ján Tomko <jtomko@redhat.com>
AuthorDate: 2013-08-20 17:37:08 +0200
Commit:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2013-08-27 12:45:58 +0200

    Always specify qcow2 compat level on qemu-img command line
    
    qemu-img is going to switch the default for QCOW2
    to QCOW2v3 (compat=1.1)
    
    Extend the probing for qemu-img command line options to check
    if -o compat is supported. If the volume definition specifies
    the qcow2 format but no compat level and -o compat is supported,
    specify -o compat=0.10 to create a QCOW2v2 image.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=997977

git describe: v1.1.1-233-gbab2eda
Comment 7 Hao Liu 2013-09-10 06:02:38 EDT
Using packages:
libvirt-1.1.1-3.el7.x86_64
libvirt-1.1.1-4.el7.x86_64
qemu-img-1.5.3-2.el7.x86_64
qemu-img-1.6.50-1.el7.x86_64 (self builf from git repo)

Since the patch on qemu to triger this bug has not been release.
I used a self built qemu package to test. so pls ignore the version
which I made up.

1. Confirm change on qemu.
# qemu-img create test.img 0 -f qcow2

# hexdump test.img | head -n1
**Output**
0000000 4651 fb49 0000 0200 0000 0000 0000 0000 
                        ^    <= for qemu-img-1.5.3-2.el7.x86_64
0000000 4651 fb49 0000 0300 0000 0000 0000 0000 
                        ^    <= for qemu-img-1.6.50-1.el7.x86_64
    
2. Create a storage XML file.
# cat > vol.xml << EOF
<volume>
  <name>test.qcow2</name>
  <key>/var/lib/libvirt/images/test.qcow2</key>
  <source>
  </source>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>1000</allocation>
  <target>
    <path>/var/lib/libvirt/images/test.qcow2</path>
    <format type='qcow2'/>
    <permissions>
      <mode>0644</mode>
      <owner>107</owner>
      <group>107</group>
    </permissions>
  </target>
</volume>
EOF

3. Create a volume using virsh and check its compatibility.
# virsh vol-create default vol.xml
Vol test.qcow2 created from vol.xml

# hexdump /var/lib/libvirt/images/test.qcow2 | head -n1
**Output** 
for libvirt-1.1.1-3:
0000000 4651 fb49 0000 0200 0000 0000 0000 0000
                        ^    <= with qemu-img-1.5.3-2.el7.x86_64
0000000 4651 fb49 0000 0300 0000 0000 0000 0000
                        ^    <= with qemu-img-1.6.50-1.el7.x86_64

for libvirt-1.1.1-4 with either version of qemu-img.
0000000 4651 fb49 0000 0200 0000 0000 0000 0000
                        ^    
This patch prevent the difference when using with future
qemu-img creates new image without specifying compatibility.
It is considered VERIFIED.
Comment 8 Ludek Smid 2014-06-13 06:57:27 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.