Bug 509772 - 'qemu-img convert' failed to convert an image which contains a backing file
'qemu-img convert' failed to convert an image which contains a backing file
Product: Fedora
Classification: Fedora
Component: qemu (Show other bugs)
All Linux
low Severity high
: ---
: ---
Assigned To: Glauber Costa
Fedora Extras Quality Assurance
Depends On:
Blocks: F12VirtTarget
  Show dependency treegraph
Reported: 2009-07-06 01:06 EDT by Akkarit Sangpetch
Modified: 2009-08-07 07:19 EDT (History)
6 users (show)

See Also:
Fixed In Version: qemu-0.10.91-0.4.rc1.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-08-07 07:19:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
qemu-img fix convert patch (1.59 KB, patch)
2009-07-06 01:06 EDT, Akkarit Sangpetch
no flags Details | Diff

  None (edit)
Description Akkarit Sangpetch 2009-07-06 01:06:01 EDT
Created attachment 350570 [details]
qemu-img fix convert patch

Description of problem:
In qemu 0.10.50, qemu-img convert failed to produce a valid image if the source image referenced a backing file.

Version-Release number of selected component (if applicable):
(from fedora-virt-preview repo)

How reproducible:
Happens every time.

Steps to Reproduce:
Suppose we have an image base.qcow2
1. qemu-img create -b base.qcow2 -f qcow2 temp.qcow2
2. do something with temp.qcow2 (run a vm, write a file, etc.)
3. qemu-img convert -O qcow2 temp.qcow2 rebase.qcow2
Actual results:
The content of rebase.qcow2 is exactly the same as temp.qcow2, but without any backing file reference. This makes the file unusable.

Expected results:
In earlier version, qemu-img convert produced a rebased version (it also removed reference to the backing files but the final image contains merged contents from both base.qcow2 and temp.qcow2)

Additional info:
I tested this with Fedora 11 with fedora-virt-preview package.

I suspect that this was caused by a patch which handles host_device format in qemu-img. Comparing with previous working version (0.10.5), 0.10.50 seems to assume a '-B' options when using qemu-img convert, so it skips writing base content even if the option was not specified. The attached patch seems to correct the situation.
Comment 1 Glauber Costa 2009-07-06 10:37:17 EDT
Hi Akkarit,

thanks for the report and patch. Can you send this patch upstream?
Once it gets accepted upstream, it becomes much easier for us to backport it.
Comment 2 Mark McLoughlin 2009-08-07 07:19:05 EDT
Excellent stuff Akkarit, thanks for getting the patch upstream!

The patch is now in F-12 since qemu-0.10.91-0.4.rc1.fc12:


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