Bug 1241710

Summary: qemu-img convert fails at 2 GB
Product: [Fedora] Fedora Reporter: Persona non grata <nobody+384088>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 22CC: amit.shah, berrange, cfergeau, crobinso, dwmw2, itamar, kwolf, nobody+384088, pbonzini, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-11 18:33:37 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:
Embargoed:
Attachments:
Description Flags
strace output none

Description Persona non grata 2015-07-09 22:00:38 UTC
Description of problem:
If you try to compress/convert an qcow2 image file, whos content is larger than 2 GB, it fails. 



Version-Release number of selected component (if applicable):
qemu-img-2.3.0-5.fc22.x86_64



How reproducible:
Always



Steps to Reproduce:
1. Create an qcow2 image and install something inside (e. g. Windows), so that the content inside is larger than 2 GB.
2. Try to compress/convert the image.



Actual results:
# qemu-img convert -c -O qcow2 Windows10.qcow2 Windows10.qcow2.shrunk
qemu-img: error while compressing sector 8620672: Input/output error

qemu-img stops with this error, when the destination file (Windows10.qcow2.shrunk) reaches 2 GB:

# ls -la Windows10*
-rw-r----- 1 root root 38588776448  9. Jul 23:15 Windows10.qcow2
-rw-r--r-- 1 root root  2147614720  9. Jul 23:46 Windows10.qcow2.shrunk

This is reproducable with all my image files, with content inside larger than 2 GB.

The filesystem, where the images resists is ext4 and has enough free space.



Expected results:
Image file should be compressed/converted without problems.



Additional info:
Fedora 21 had qemu-img 2.1.3, which doesn't had this bug/problem.
An internet search showed, that others also are having this problem. E. g. https://bugs.launchpad.net/qemu/+bug/1452062

Comment 1 Cole Robinson 2015-07-14 18:12:06 UTC
Thanks for the report. Can you provide the info that Kevin asked for in the launchpad bug?

"Can you please run qemu-img under strace -f and either provide the output as an attachment or paste the relevant failing call(s) if you can recognise them?"

Comment 2 Persona non grata 2015-07-14 19:09:56 UTC
Created attachment 1051991 [details]
strace output

(In reply to Cole Robinson from comment #1)
> "Can you please run qemu-img under strace -f and either provide the output
> as an attachment or paste the relevant failing call(s) if you can recognise
> them?"

Find attached the last 5000 line of the strace output. If you need a longer output, just let me know.

Comment 3 Cole Robinson 2015-08-10 17:29:29 UTC
kevin, see comment #2 for strace output for qemu-img conversion failure. You requested it in the launchpad bug

Comment 4 Kevin Wolf 2015-08-11 09:29:00 UTC
Danke, Marc. This report is more helpful than the Launchpad one.

As it turns out, this is already fixed in upstream qemu. The bug was introduced
with commit 8c44dfbc (first in 2.3.0) and fixed with commit 3e5feb62 (first in
v2.4.0-rc0).

Cole, the fix is easy to backport. git cherry-pick will complain about a
conflict, but what the patch really does there is just changing indentation, so
it's trivial to resolve.

Comment 5 Cole Robinson 2015-08-11 13:53:26 UTC
Thanks, I'll pull in the fix for the next f22 build

Comment 6 Cole Robinson 2015-08-11 18:33:37 UTC
Actually that fix was already pushed in qemu-2.3.0-6.fc22 for bug 1214855, so duping to that

*** This bug has been marked as a duplicate of bug 1214855 ***