core: fix removing VMs not registered in libvirt
It can happen that VM will not be registered in libvirt (for example when it was never started). It shouldn't be a problem when we want to remove it.
This commit is contained in:
parent
ed03fb4313
commit
b985bf3b65
@ -1281,7 +1281,14 @@ class QubesVm(object):
|
||||
for hook in self.hooks_remove_from_disk:
|
||||
hook(self)
|
||||
|
||||
self.libvirt_domain.undefine()
|
||||
try:
|
||||
self.libvirt_domain.undefine()
|
||||
except libvirt.libvirtError as e:
|
||||
if e.err[0] == libvirt.VIR_ERR_NO_DOMAIN:
|
||||
# already undefined
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
self.storage.remove_from_disk()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user