Bug 1330916

Summary: image cannot be fully allocated via qemu-img with sparse_size specified as 0
Product: Red Hat Enterprise Linux 7 Reporter: Ping Li <pingl>
Component: qemu-kvm-rhevAssignee: Max Reitz <mreitz>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: aliang, chayang, coli, jen, juzhang, knoel, meyang, michen, mrezanin, ngu, shuang, virt-maint, xiagao, xutian, xuwei
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-2.6.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-07 21:05:38 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:

Description Ping Li 2016-04-27 10:20:38 UTC
Description of problem:
After convert the source image with the option "-S 0", the dest image will not be fully allocated.

Version-Release number of selected component (if applicable):
[root@ibm-x3650m3-03 test]# rpm -qa | grep qemu-img
qemu-img-rhev-2.5.0-4.el7.x86_64
[root@ibm-x3650m3-03 test]# uname -r
3.10.0-382.el7.x86_64

How reproducible:
3/3

Steps to Reproduce:
1.qemu-img create -f qcow2 src.qcow2 10G
2.qemu-img create -f qcow2 src.qcow2 10G
3.qemu-img convert -p -f qcow2 -O qcow2 -S 0 src.qcow2 dst.qcow2
4.qemu-img info dst.qcow2

Actual results:
[root@ibm-x3650m3-03 test]# qemu-img info dst.qcow2 
image: dst.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 2.1M
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
[root@ibm-x3650m3-03

Expected results:
disk size should be greater than or eqaul to the virtual size.

Additional info:
[root@ibm-x3650m3-03 test]# qemu-img info src.qcow2 
image: src.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

Comment 2 Max Reitz 2016-05-11 14:52:45 UTC
Fix will be included in 2.6.0.

Comment 4 Ping Li 2016-05-13 06:49:23 UTC
[root@hp-z420-02 home]# uname -r
3.10.0-396.el7.x86_64
[root@hp-z420-02 home]# rpm -qa | grep qemu-kvm
qemu-kvm-rhev-2.6.0-1.el7.x86_64
[root@hp-z420-02 home]# qemu-img create -f qcow2 src.qcow2 10G
Formatting 'src.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@hp-z420-02 home]# qemu-img convert -p -f qcow2 -O qcow2 -S 0 src.qcow2 dst.qcow2
    (100.00/100%)
[root@hp-z420-02 home]# qemu-img info src.qcow2 
image: src.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 196K
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
[root@hp-z420-02 home]# qemu-img info dst.qcow2 
image: dst.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 10G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

Comment 6 errata-xmlrpc 2016-11-07 21:05:38 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.

https://rhn.redhat.com/errata/RHBA-2016-2673.html