Add wait time between flush migrates
Adds a wait timer between each VM migration during a flush action, based on the state of the target VM. This causes each state change command to wait until the last VM has completed its migration, preventing all a node's VMs from being migrated to the same "least RAM" hypervisor at once before any start to migrate. Fixes #6
This commit is contained in:
parent
368c7ea99b
commit
6d779a811b
|
@ -161,6 +161,13 @@ class NodeInstance():
|
|||
'/domains/{}/lasthypervisor'.format(dom_uuid): current_hypervisor
|
||||
})
|
||||
|
||||
# Wait for the VM to migrate so the next VM's free RAM count is accurate (they migrate in serial anyways)
|
||||
while True:
|
||||
time.sleep(1)
|
||||
vm_current_state = zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(domuuid))
|
||||
if vm_current_state == "start":
|
||||
break
|
||||
|
||||
zkhandler.writedata(self.zk_conn, { '/nodes/{}/runningdomains'.format(self.name): '' })
|
||||
zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'flushed' })
|
||||
self.inflush = False
|
||||
|
|
Loading…
Reference in New Issue