Red Hat Bugzilla – Bug 1297653
"qemu-img convert" can't create a fully allocated image passed a "-S 0" option
Last modified: 2017-03-21 05:36:30 EDT
Description of problem: As summary, "qemu-img convert" can not to create a fully allocated image with a "-S 0" option Version-Release number of selected component (if applicable): qemu-kvm-rhev-0.12.1.2-2.483.el6.x86_64 kernel-2.6.32-595.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1.create a qcow2 image by default. # qemu-img create -f qcow2 my-data-disk.qcow2 10G Formatting 'my-data-disk.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 2.# qemu-img info my-data-disk.qcow2 image: my-data-disk.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 136K cluster_size: 65536 3."qemu-img convert" can be passed a "-S 0" option to create a fully allocated image # qemu-img convert -p -f qcow2 -O qcow2 **-S 0** my-data-disk.qcow2 dest.image (100.00/100%) 4.# qemu-img info dest.image Actual results: # qemu-img info dest.image image: dest.image file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 136K cluster_size: 65536 Expected results: verify th disk size is the same to vritual size. # qemu-img info dest.image image: dest.image file format: qcow2 virtual size: **10G** (10737418240 bytes) **disk size: 10G** Additional info: 1.this issue can be reproduced on rhel6.7 release version and rhel7.2.z version qemu-kvm-rhev-0.12.1.2-2.479.el6.x86_64 qemu-kvm-rhev-0.12.1.2-2.479.el6_7.3.x86_64 qemu-kvm-rhev-2.3.0-31.el7_2.5.x86_64
Test it on rhel7.2.z host. version: qemu-kvm-rhev-2.3.0-31.el7_2.5.x86_64 steps: 1.create a qcow2 image by default. # qemu-img create -f qcow2 my-data-disk.qcow2 10G Formatting 'my-data-disk.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 2.# qemu-img info my-data-disk.qcow2 image: my-data-disk.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 3.# qemu-img convert -p -f qcow2 -O qcow2 -S 0 my-data-disk.qcow2 dest.image (100.00/100%) 4.# qemu-img info dest.image image: dest.image 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 result: The disk size is not the same with vritual size.
Fix included in qemu-kvm-0.12.1.2-2.495.el6
Reproduce this bug Host version: kernel-2.6.32-642.el6.x86_64 qemu-kvm-0.12.1.2-2.490.el6.x86_64 Steps to Reproduce: 1.create a qcow2 image by default. # qemu-img create -f qcow2 my-data-disk.qcow2 10G Formatting 'my-data-disk.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 2.# qemu-img info my-data-disk.qcow2 image: my-data-disk.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 196K cluster_size: 65536 3.# qemu-img convert -p -f qcow2 -O qcow2 -S 0 my-data-disk.qcow2 dest.image (100.00/100%) 4.# qemu-img info dest.image image: dest.image file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 196K cluster_size: 65536 Result: The disk size is not the same with vritual size. ------------------------------------------------- Verify this bug on "qemu-kvm-0.12.1.2-2.495.el6.x86_64" as same steps above. Test results:The disk size is the same with vritual size. # qemu-img info dest.image image: dest.image file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 10G cluster_size: 65536 According to result above,this bug has been fixed.
(In reply to Yiqian Wei from comment #6) > Reproduce this bug > Host version: > kernel-2.6.32-642.el6.x86_64 > qemu-kvm-0.12.1.2-2.490.el6.x86_64 > Steps to Reproduce: > 1.create a qcow2 image by default. > # qemu-img create -f qcow2 my-data-disk.qcow2 10G > Formatting 'my-data-disk.qcow2', fmt=qcow2 size=10737418240 encryption=off > cluster_size=65536 > > 2.# qemu-img info my-data-disk.qcow2 > image: my-data-disk.qcow2 > file format: qcow2 > virtual size: 10G (10737418240 bytes) > disk size: 196K > cluster_size: 65536 > > 3.# qemu-img convert -p -f qcow2 -O qcow2 -S 0 my-data-disk.qcow2 dest.image > (100.00/100%) > > 4.# qemu-img info dest.image > image: dest.image > file format: qcow2 > virtual size: 10G (10737418240 bytes) > disk size: 196K > cluster_size: 65536 > > Result: > The disk size is not the same with vritual size. > ------------------------------------------------- > Verify this bug on "qemu-kvm-0.12.1.2-2.495.el6.x86_64" as same steps above. > > Test results:The disk size is the same with vritual size. > # qemu-img info dest.image > image: dest.image > file format: qcow2 > virtual size: 10G (10737418240 bytes) > disk size: 10G > cluster_size: 65536 > > According to result above,this bug has been fixed. Thanks Yiqian. Set this BZ as verified.
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/RHSA-2017-0621.html