Bug 1297653 - "qemu-img convert" can't create a fully allocated image passed a "-S 0" option
"qemu-img convert" can't create a fully allocated image passed a "-S 0" option
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.8
x86_64 Unspecified
medium Severity medium
: rc
: ---
Assigned To: Max Reitz
Ping Li
Yehuda Zimmerman
:
Depends On:
Blocks: 1359965 1364808
  Show dependency treegraph
 
Reported: 2016-01-12 01:27 EST by xiagao
Modified: 2017-03-21 05:36 EDT (History)
15 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.495.el6
Doc Type: Bug Fix
Doc Text:
"-S 0" for "qemu-img convert" now works correctly Previously, specifying the "-S 0" option with "qemu-img convert" did not always explicitly write zeroes to all sparse areas in the output file. As a result, running "qemu-img convert -S 0" did not always result in a fully allocated output file. With this update, the command has been fixed, and running "qemu-img convert -S 0" always results in a fully allocated output file. Note that the qcow2 format offers a different preallocation option which can convert images to fully allocated output files faster than using the "-S 0" option. However, with other formats, this can only be achieved with the "-S 0" option.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-21 05:36:30 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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:0621 normal SHIPPED_LIVE Moderate: qemu-kvm security and bug fix update 2017-03-21 08:28:31 EDT

  None (edit)
Description xiagao 2016-01-12 01:27:15 EST
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
Comment 2 xiagao 2016-01-12 01:46:09 EST
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.
Comment 4 Yash Mankad 2016-10-27 16:33:01 EDT
Fix included in qemu-kvm-0.12.1.2-2.495.el6
Comment 6 Yiqian Wei 2016-10-27 23:29:54 EDT
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.
Comment 7 Ping Li 2016-10-31 01:48:31 EDT
(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.
Comment 12 errata-xmlrpc 2017-03-21 05:36:30 EDT
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

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