Bug 607091

Summary: virt-install doesn't check for existing file before over-writing it as install image
Product: Red Hat Enterprise Linux 6 Reporter: Jes Sorensen <Jes.Sorensen>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: dallan, dyuan, kxiong, mhideo, xen-maint, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Unless the file image is already managed by libvirt, when a user specifies an existing file image with virt-install there is no warning displayed telling the user that the file will be overwritten. With this change the user is now prompted if the file already exists giving the user an opportunity to make any necessary corrections before overwriting the file image.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:45:31 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:

Description Jes Sorensen 2010-06-23 07:51:56 UTC
Description of problem:
When using virt-install and specifying an existing file image, you
get no warning that you are about to overwrite an existing file - unless
the file is an image already managed by libvirt.

Version-Release number of selected component (if applicable):
python-virtinst-0.500.3-2.el6.noarch

How reproducible:
Every time - see below

Steps to Reproduce:
1. Install guest using virt-install
2. In virt-manager delete guest, but do not check the box to remove image
3. Install another guest using virt-install into the same file image
4. Or see example below.
  
Actual results:
virt-install happily launches the install onto the existing file. If it 
is an old previously installed image, for instance with XP that failed
after stage, it will boot it as it is in stage2 of the XP install rather
than start over again.

Expected results:


Additional info:
[root@batcave ~]# dd if=/dev/zero of=/var/lib/libvirt/images/arm2.img bs=1G count=10
10+0 records in
10+0 records out
10737418240 bytes (11 GB) copied, 169.341 s, 63.4 MB/s
[root@batcave ~]# virt-install --prompt --os-type=windows --os-variant=winxpWhat is the name of your virtual machine? blahblah
 How much RAM should be allocated (in megabytes)? 1024
 What would you like to use as the disk (file path)? /var/lib/libvirt/images/arm2.img
 What is the install CD-ROM/ISO or URL? /home/isos/en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso
 

Starting install...
Creating domain...                                       |    0 B     00:00     
Domain installation still in progress. Waiting for installation to complete.

Comment 2 RHEL Program Management 2010-06-23 08:23:13 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 3 RHEL Program Management 2010-07-15 14:55:29 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 4 Jes Sorensen 2010-07-16 07:08:14 UTC
Since it didn't make the 6.0 cute, please make sure to fix this before 6.1.
It's a very annoying bug.

Thanks,
Jes

Comment 6 Cole Robinson 2010-12-08 00:04:52 UTC
Fixed upstream:

http://hg.fedorahosted.org/hg/python-virtinst/rev/f10c74b09e80

$ ./virt-install --connect test:///default --prompt --name foo --ram 64 --pxe --hvm
What would you like to use as the disk (file path)? 
README
This will overwrite the existing path '/mnt/storage.bos/boston/crobinso/sandbox/upstream/python-virtinst/virtinst.upstream/README'
Do you really want to use this disk (yes or no) 
no
What would you like to use as the disk (file path)?

Comment 7 Cole Robinson 2011-01-14 22:09:24 UTC
Fix built in python-virtinst-0.500.5-1.el6

Comment 9 koka xiong 2011-01-19 06:07:15 UTC
Verified with python-virtinst-0.500.5-1.el6 passed.
1.virt-install --connect test:///default --prompt --name foo --ram 64 --pxe --hvm
2.What would you like to use as the disk (file path)? 
/var/lib/libvirt/images/rhel55-i386.img
This will overwrite the existing path '/var/lib/libvirt/images/rhel55-i386.img'
Do you really want to use this disk (yes or no) 
no
What would you like to use as the disk (file path)? 
So it will check the existing file before over-writing it.
Verification is passed.

Comment 10 zhe peng 2011-04-15 10:11:06 UTC
verified this bug with:
Linux localhost.localdomain 2.6.32-130.el6.x86_64 #1 SMP Tue Apr 5 19:58:31 EDT
2011 x86_64 x86_64 x86_64 GNU/Linux

python-virtinst-0.500.5-3.el6.noarch
libvirt-0.8.7-17.el6.x86_64

passed.

Comment 12 Michael Hideo 2011-05-13 00:17:31 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:
* Unless the file image is already managed by libvirt, when a user specifies an existing file image with virt-install there is no warning displayed telling the user that the file will be overwritten. With this change the user is now prompted if the file already exists giving the user an opportunity to make any necessary corrections before overwriting the file image. (BZ#607091)

Comment 13 Michael Hideo 2011-05-16 21:44:53 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 +1 @@
-* Unless the file image is already managed by libvirt, when a user specifies an existing file image with virt-install there is no warning displayed telling the user that the file will be overwritten. With this change the user is now prompted if the file already exists giving the user an opportunity to make any necessary corrections before overwriting the file image. (BZ#607091)+Unless the file image is already managed by libvirt, when a user specifies an existing file image with virt-install there is no warning displayed telling the user that the file will be overwritten. With this change the user is now prompted if the file already exists giving the user an opportunity to make any necessary corrections before overwriting the file image.

Comment 14 errata-xmlrpc 2011-05-19 13:45:31 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/RHBA-2011-0636.html