Handle stopping the VM when its ZK config is deleted or it shouldn't be running

This commit is contained in:
Joshua Boniface 2018-06-06 11:46:24 -04:00
parent dc661a8ea8
commit 5edb5d1e77
1 changed files with 4 additions and 0 deletions

View File

@ -213,6 +213,10 @@ class VMInstance:
if running == libvirt.VIR_DOMAIN_RUNNING and self.state == "stop" and self.hypervisor == self.thishypervisor.name and self.instop == False:
self.stop_vm()
# We got no state, so the VM is deleted and should be stopped
elif running == libvirt.VIR_DOMAIN_NOSTATE:
self.stop_vm()
# VM should be shut down
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "shutdown" and self.hypervisor == self.thishypervisor.name and self.inshutdown == False:
self.shutdown_vm()