Red Hat Bugzilla – Bug 509772
'qemu-img convert' failed to convert an image which contains a backing file
Last modified: 2009-08-07 07:19:05 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)
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
The content of rebase.qcow2 is exactly the same as temp.qcow2, but without any backing file reference. This makes the file unusable.
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)
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.
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.
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: