Fix some startup weirdness in ordering

This commit is contained in:
Joshua Boniface 2018-06-02 15:54:43 -04:00
parent 2349e56fc1
commit 0826b508ad
1 changed files with 6 additions and 5 deletions

View File

@ -152,6 +152,12 @@ class VMInstance:
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor != self.thishypervisor.name:
self.migrate_vm()
# VM is already running and should be
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name:
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
self.dom = conn.lookupByUUID(uuid.UUID(self.domuuid).bytes)
# VM should be started
elif running != libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name:
# Grab the domain information from Zookeeper
@ -159,10 +165,5 @@ class VMInstance:
domxml = str(domxml.decode('ascii'))
self.start_vm(conn, domxml)
# VM is already running and should be
elif running == libvirt.VIR_DOMAIN_RUNNING and self.state == "start" and self.hypervisor == self.thishypervisor.name:
if not self.domuuid in self.thishypervisor.domain_list:
self.thishypervisor.domain_list.append(self.domuuid)
# The VM should now be running so return the domain and active connection
conn.close