Bug 509772

Summary: 'qemu-img convert' failed to convert an image which contains a backing file
Product: [Fedora] Fedora Reporter: Akkarit Sangpetch <asangpet>
Component: qemuAssignee: Glauber Costa <gcosta>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: rawhideCC: dwmw2, gcosta, itamar, jaswinder, markmc, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: qemu-0.10.91-0.4.rc1.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-07 07:19:05 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 498969    
Description Flags
qemu-img fix convert patch none

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: