qvm-remove: don't fail on removing template which was never started
When a template never was started, it isn't defined in libvirt, so attempt to undefine it will fail. Fixes QubesOS/qubes-issues#2290
This commit is contained in:
parent
7ae55d46b2
commit
84528b30c1
@ -22,7 +22,8 @@
|
||||
#
|
||||
|
||||
from qubes.qubes import QubesVmCollection
|
||||
from optparse import OptionParser;
|
||||
from optparse import OptionParser
|
||||
import libvirt
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -82,7 +83,11 @@ def main():
|
||||
if options.remove_from_db_only:
|
||||
# normally it is done by vm.remove_from_disk(), but it isn't
|
||||
# called in this case
|
||||
try:
|
||||
vm.libvirt_domain.undefine()
|
||||
except libvirt.libvirtError:
|
||||
# ignore the case when it was never defined
|
||||
pass
|
||||
if vm.installed_by_rpm:
|
||||
if options.verbose:
|
||||
print >> sys.stderr, "--> VM installed by RPM, leaving all the files on disk"
|
||||
|
Loading…
Reference in New Issue
Block a user