Bug 635354

Summary: Can not commit copy-on-write image's data to raw backing-image
Product: Red Hat Enterprise Linux 6 Reporter: Mike Cao <bcao>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.0CC: akong, ddumas, ehabkost, kwolf, lihuang, mhusnain, michen, mjenner, mkenneth, ndai, syeghiay, szhou, tburke, virt-maint
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.114.el6 Doc Type: Bug Fix
Doc Text:
Previously, when a QCOW2 image was committed to a backing file, the backing file was erroneously opened as a QCOW2 format file instead of its correct format, which caused a "qemu-img: Error while committing image" error to display. This is fixed to ensure that backing files are now opened in the correct format and images commits execute as expected.
Story Points: ---
Clone Of:
: 640949 (view as bug list) Environment:
Last Closed: 2011-05-19 11:22:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 580951, 641835    

Description Mike Cao 2010-09-19 07:50:50 UTC
Description of problem:
Can not commit copy-on-write image's data to raw backing-image 

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.54.el6

How reproducible:
100%

Steps to Reproduce:
1.create a raw image #qemu-img create -f raw Mike 5G
2.create snapshot disk : #qemu-img create -F raw -f qcow2 -b Mike Mike.sp
3.write some datas to the snapshot disk 
eg:#qemu-io Mike.sp
qemu-io> write 0 512k -P 3
4.commit snapshot datas to the backing-image 
eg:# qemu-img commit Mike.sp
  
Actual results:
# qemu-img commit Mike.sp
qemu-img: Error while committing image


Expected results:
# qemu-img commit Mike.sp
Image committed.

Additional info:
re-tested on qemu-kvm-0.12.1.2-2.53.el6 , it works fine.

Comment 7 Kevin Wolf 2010-10-07 10:38:45 UTC
Bill asked me to clarify what this bug actually means.

When committing the content of a qcow2 image to its backing file, the backing file is reopened as qcow2 instead of its real format. This means that committing fails when you use other formats for the backing file, most importantly raw. If you do this from within a running VM (using the 'commit' monitor command), the VM will lose access to the disk. The integrity of the image is not harmed.

Comment 10 Mike Cao 2010-10-12 04:48:09 UTC
Verified on qemu-kvm-0.12.1.2-2.115.el6
backding file:
block_device(raw)--->pass
block_device(qcow2)--->pass
file(raw)--->pass
file(qcow2)--->pass

based on above ,this issue has been fixed .

Comment 11 Jaromir Hradilek 2010-10-27 13:54:09 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, attempting to commit a copy-on-write image to a raw backing disk image using the "quemu-img commit" command may have failed with the following error:

  qemu-img: Error while committing image

With this update, this error no longer occurs, and such images can now be committed as expected.

Comment 13 Shirley Zhou 2010-12-30 03:26:00 UTC
Re-verify this bug with package qemu-kvm-0.12.1.2-2.128.el6.x86_64 as following steps:

1. install guest in base image
2. create snapshot for base image
3. start snapshot, and dd 1G size file in guest
4. shutdown snapshot, do snapshot commit
5. start base image, check big file using cksum, if cksum is same, pass

Verify four kind of images as following

block device (qcow2)
block device (raw)
File (qcow2)
File (raw)

All pass, so this bug has been fixed.

Comment 15 Eduardo Habkost 2011-05-05 15:03:07 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,5 +1,12 @@
-Previously, attempting to commit a copy-on-write image to a raw backing disk image using the "quemu-img commit" command may have failed with the following error:
+Cause: backing file re-opening code opened the backing file with the wrong format.
 
+Consequence:
+
+attempting to commit a copy-on-write image to a raw backing disk image using the "quemu-img commit" command may have failed with the following error:
+
   qemu-img: Error while committing image
 
-With this update, this error no longer occurs, and such images can now be committed as expected.+
+Fix: the block device backing file re-open code now re-opens the backing file with the backing file format and not with the format of the snapshot image.
+
+Result: With this update, the 'Error while committing image' error no longer occurs when using 'qemu-img commit', and the images can now be committed as expected.

Comment 16 Misha H. Ali 2011-05-12 04:25:56 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,12 +1 @@
-Cause: backing file re-opening code opened the backing file with the wrong format.
+Previously, when a QCOW2 image was committed to a backing file, the backing file was erroneously opened as a QCOW2 format file instead of its correct format, which caused a "qemu-img: Error while committing image" error to display. This is fixed to ensure that backing files are now opened in the correct format and images commits execute as expected.-
-Consequence:
-
-attempting to commit a copy-on-write image to a raw backing disk image using the "quemu-img commit" command may have failed with the following error:
-
-  qemu-img: Error while committing image
-
-
-Fix: the block device backing file re-open code now re-opens the backing file with the backing file format and not with the format of the snapshot image.
-
-Result: With this update, the 'Error while committing image' error no longer occurs when using 'qemu-img commit', and the images can now be committed as expected.

Comment 17 errata-xmlrpc 2011-05-19 11:22:58 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html

Comment 18 errata-xmlrpc 2011-05-19 12:48:58 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0534.html