Move that command to the very end so it won't override any others

This commit is contained in:
Joshua Boniface 2018-06-06 11:51:12 -04:00
parent 67571434a5
commit aab86d065d
1 changed files with 5 additions and 4 deletions

View File

@ -216,10 +216,6 @@ 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 and the VM isn't told to stop, so the VM is deleted and should be stopped
elif running == libvirt.VIR_DOMAIN_NOSTATE and self.state != "stop" and self.inshutdown == False and self.instop == False:
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()
@ -244,6 +240,11 @@ class VMInstance:
domxml = str(domxml.decode('ascii'))
self.start_vm(domxml)
# 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 and self.state != "stop" and self.inshutdown == False and self.instop == False:
self.stop_vm()
# This function is a wrapper for libvirt.lookupByUUID which fixes some problems
# 1. Takes a text UUID and handles converting it to bytes
# 2. Try's it and returns a sensible value if not