Bug 509772 - 'qemu-img convert' failed to convert an image which contains a backing file
Summary: 'qemu-img convert' failed to convert an image which contains a backing file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: rawhide
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Glauber Costa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F12VirtTarget
TreeView+ depends on / blocked
 
Reported: 2009-07-06 05:06 UTC by Akkarit Sangpetch
Modified: 2009-08-07 11:19 UTC (History)
6 users (show)

Fixed In Version: qemu-0.10.91-0.4.rc1.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-07 11:19:05 UTC
Type: ---
Embargoed:


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

Description Akkarit Sangpetch 2009-07-06 05:06:01 UTC
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):
qemu-img-0.10.50-8.kvm87.fc11.x86_64
(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 14:37:17 UTC
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 11:19:05 UTC
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:

  http://git.et.redhat.com/?p=qemu-fedora.git;a=commitdiff;h=ca95814efb


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