Improve the logic of the on-delete-stop a bit to avoid spurious stop calls

This commit is contained in:
Joshua Boniface 2018-06-06 11:50:02 -04:00
parent 5ca3f6860b
commit 67571434a5
1 changed files with 2 additions and 2 deletions

View File

@ -216,8 +216,8 @@ class VMInstance:
if running == libvirt.VIR_DOMAIN_RUNNING and self.state == "stop" and self.hypervisor == self.thishypervisor.name and self.instop == False: if running == libvirt.VIR_DOMAIN_RUNNING and self.state == "stop" and self.hypervisor == self.thishypervisor.name and self.instop == False:
self.stop_vm() self.stop_vm()
# We got no state, so the VM is deleted and should be stopped # We got no state and the VM isn't told to stop, so the VM is deleted and should be stopped
elif running == libvirt.VIR_DOMAIN_NOSTATE: elif running == libvirt.VIR_DOMAIN_NOSTATE and self.state != "stop" and self.inshutdown == False and self.instop == False:
self.stop_vm() self.stop_vm()
# VM should be shut down # VM should be shut down