Bug 1212617

Summary: virt-install does not remove orphaned images on failure
Product: [Fedora] Fedora Reporter: John Snow <jsnow>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: berrange, crobinso, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.3.2-1.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-31 00:54:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Snow 2015-04-16 19:34:42 UTC
Description of problem:

If virt-install fails early on before it boots a VM, it does not remove any images that it has created. This leads to junk images not attached to any VM accumulating in host storage.

Version-Release number of selected component (if applicable):

Fedora 22 RC2
virt-install.noarch 1.1.0-7.git6dbe19bd8.fc22

How reproducible:

100%
See BZ #867546 for a related bug.

Steps to Reproduce:
1. Install F22 RC2
2. sudo dnf groupinstall virtualization
3. sudo virt-install --name test-day-vm --ram 2048 --disk size=32 --cdrom en_windows_7_ultimate_n_with_sp1_x64_dvd_u_677543.iso --os-variant win7
4. Observe that, due to BZ #867546, installation fails:

Starting install...
Allocating 'test-day-vm-1.qcow2'
ERROR Network not found: no network with matching name 'default'
....

5. Observe that e.g. /var/lib/libvirt/images/test-day-vm-1.qcow2 still exists, though it has no matching VM and no data has been written to it yet. (It can be safely discarded.)


Actual results:

Useless ghost image persists within the host storage pool.

Expected results:

Useless image is deleted upon failure to prevent garbage images from accumulating within the storage pool.

Comment 1 Cole Robinson 2015-09-24 20:04:43 UTC
This is fixed upstream now:

commit 1237be9d1a39e6382057d2056713618ad32bb12f
Author: Cole Robinson <crobinso>
Date:   Sun Sep 6 13:42:07 2015 -0400

    virt-install: Clean up created disk images if VM creation fails
    
    We are conservative here, only cleaning up disk images if libvirt
    fails to even accept the XML. Otherwise the VM may already be
    running or defined, and the user has to do some cleanup anyways.

Comment 2 Cole Robinson 2015-11-25 19:14:10 UTC
This stuff is slightly invasive and won't be backported to f22, so moving to f23 (where this will be fixed by the rebase)

Comment 3 Fedora Update System 2015-11-25 20:09:23 UTC
virt-manager-1.3.0-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-7dfc5692ef

Comment 4 Fedora Update System 2015-11-26 23:50:24 UTC
virt-manager-1.3.0-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update virt-manager'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-7dfc5692ef

Comment 5 Fedora Update System 2015-12-07 01:07:28 UTC
virt-manager-1.3.1-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6cf48609ca

Comment 6 Fedora Update System 2015-12-08 04:32:13 UTC
virt-manager-1.3.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update virt-manager'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6cf48609ca

Comment 7 Fedora Update System 2015-12-24 19:02:41 UTC
virt-manager-1.3.2-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-237e1d49a8

Comment 8 Fedora Update System 2015-12-29 00:56:57 UTC
virt-manager-1.3.2-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-237e1d49a8

Comment 9 Fedora Update System 2015-12-31 00:54:27 UTC
virt-manager-1.3.2-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.