Handle VM states in flush more accurately
We don't want to block forever on a failure, so limit valid waiting states to just those we know it should be in during a migration.
This commit is contained in:
		@@ -643,7 +643,7 @@ class NodeInstance(object):
 | 
				
			|||||||
                zkhandler.writedata(self.zk_conn, { '/domains/{}/node_autostart'.format(dom_uuid): 'True' })
 | 
					                zkhandler.writedata(self.zk_conn, { '/domains/{}/node_autostart'.format(dom_uuid): 'True' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                # Wait for the VM to shut down
 | 
					                # Wait for the VM to shut down
 | 
				
			||||||
                while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'stop':
 | 
					                while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['shutdown']:
 | 
				
			||||||
                    time.sleep(1)
 | 
					                    time.sleep(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
@@ -656,7 +656,7 @@ class NodeInstance(object):
 | 
				
			|||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Wait for the VM to migrate so the next VM's free RAM count is accurate (they migrate in serial anyways)
 | 
					            # Wait for the VM to migrate so the next VM's free RAM count is accurate (they migrate in serial anyways)
 | 
				
			||||||
            while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'start':
 | 
					            while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['migrate', 'unmigrate', 'shutdown']:
 | 
				
			||||||
                time.sleep(1)
 | 
					                time.sleep(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        zkhandler.writedata(self.zk_conn, { '/nodes/{}/runningdomains'.format(self.name): '' })
 | 
					        zkhandler.writedata(self.zk_conn, { '/nodes/{}/runningdomains'.format(self.name): '' })
 | 
				
			||||||
@@ -705,7 +705,7 @@ class NodeInstance(object):
 | 
				
			|||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Wait for the VM to migrate back
 | 
					            # Wait for the VM to migrate back
 | 
				
			||||||
            while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) != 'start':
 | 
					            while zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(dom_uuid)) in ['migrate', 'unmigrate', 'shutdown']:
 | 
				
			||||||
                time.sleep(1)
 | 
					                time.sleep(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })
 | 
					        zkhandler.writedata(self.zk_conn, { '/nodes/{}/domainstate'.format(self.name): 'ready' })
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user