set (at exit) status of non-stopped vms on this host to 'REQUESTED_NEW'
This commit is contained in:
		
					parent
					
						
							
								0ee9418fb9
							
						
					
				
			
			
				commit
				
					
						cbcbbdd9d7
					
				
			
		
					 1 changed files with 2 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
										
									
									
									
								
							| 
						 | 
					@ -65,6 +65,8 @@ def goodbye(host):
 | 
				
			||||||
    vms = filter(lambda v: v.value["hostname"] == host.key, vms)
 | 
					    vms = filter(lambda v: v.value["hostname"] == host.key, vms)
 | 
				
			||||||
    for vm in vms:
 | 
					    for vm in vms:
 | 
				
			||||||
        vm.value["hostname"] = ""
 | 
					        vm.value["hostname"] = ""
 | 
				
			||||||
 | 
					        if vm.value["status"] != "STOPPED":
 | 
				
			||||||
 | 
					            vm.value["status"] = "REQUESTED_NEW"
 | 
				
			||||||
        client.put(vm.key, vm.value, value_in_json=True)
 | 
					        client.put(vm.key, vm.value, value_in_json=True)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    logging.info(f"Host {host.key} dead! at {host.value['last_heartbeat']}")
 | 
					    logging.info(f"Host {host.key} dead! at {host.value['last_heartbeat']}")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue