Don't die with attribute error if we can't destroy VM

This commit is contained in:
Joshua Boniface 2018-06-06 11:48:28 -04:00
parent 5edb5d1e77
commit 5ca3f6860b
1 changed files with 4 additions and 1 deletions

View File

@ -96,7 +96,10 @@ class VMInstance:
def stop_vm(self):
print(">>> %s - Forcibly stopping VM" % self.domuuid)
self.instop = True
self.dom.destroy()
try:
self.dom.destroy()
except AttributeError:
pass
if self.domuuid in self.thishypervisor.domain_list:
try:
self.thishypervisor.domain_list.remove(self.domuuid)