Bug 653582

Summary: Changing media with -snapshot deletes image file
Product: Red Hat Enterprise Linux 6 Reporter: Kevin Wolf <kwolf>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: low    
Version: 6.1CC: mjenner, mkenneth, szhou, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.120.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:34:06 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: 580954    

Description Kevin Wolf 2010-11-15 18:08:03 UTC
Description of problem:
When using -snapshot, a new qcow2 image is created and marked as temporary so that it gets deleted. When changing media, no new overlay file is created for the new image, however it's still treated as temporary and is therefore deleted.

Steps to Reproduce:
1. Create two images, say test1.img and test2.img
2. Start qemu -cdrom test1.img -snapshot
3. In the qemu monitor enter 'change ide1-cd0 test2.img'
  
Actual results:
The image representing the CD-ROM is changed. At the same time it's deleted from the file system.

Expected results:
The image representing the CD-ROM is changed. The file stays unchanged.

Comment 6 Shirley Zhou 2010-12-24 03:20:15 UTC
Reproduce this bug with qemu-kvm-0.12.1.2-2.113.el6.x86_64.

Verify this bug with  qemu-kvm-0.12.1.2-2.128.el6.x86_64,
#CLI: /usr/libexec/qemu-kvm -cdrom qcow2.2G -snapshot -monitor stdio
(qemu) info block
ide1-cd0: type=cdrom removable=1 locked=0 file=/tmp/vl.4x0387 backing_file=/root/resize/qcow2.2G ro=0 drv=qcow2 encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /root/resize/raw.2G 
(qemu) info block
ide1-cd0: type=cdrom removable=1 locked=0 file=/tmp/vl.MA7wH3 backing_file=/root/resize/raw.2G ro=0 drv=qcow2 encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
# ll /root/resize/
total 144
-rw-r--r-- 1 root root     328192 Dec 23 21:03 qcow2.2G
-rw-r--r-- 1 root root 2147483648 Dec 23 22:21 raw.2G

So this bug has been resolved.

Comment 8 errata-xmlrpc 2011-05-19 11:34:06 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 9 errata-xmlrpc 2011-05-19 12:49:56 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