From 5edb5d1e7700eb5142138c28b84f7a3914a0c68b Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Wed, 6 Jun 2018 11:46:24 -0400 Subject: [PATCH] Handle stopping the VM when its ZK config is deleted or it shouldn't be running --- VMInstance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VMInstance.py b/VMInstance.py index 796a6ceb..6f499674 100644 --- a/VMInstance.py +++ b/VMInstance.py @@ -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()