Apply more granular timeout formatting
We don't need to wait forever if state changes aren't waiting or disable (which does a shutdown before returning).
This commit is contained in:
		@@ -377,13 +377,18 @@ def vm_state(config, vm, target_state, force=False, wait=False):
 | 
			
		||||
    API arguments: state={state}, wait={wait}
 | 
			
		||||
    API schema: {"message":"{data}"}
 | 
			
		||||
    """
 | 
			
		||||
    if wait or target_state == "disable":
 | 
			
		||||
        timeout = 300
 | 
			
		||||
    else:
 | 
			
		||||
        timeout = 3
 | 
			
		||||
 | 
			
		||||
    params = {
 | 
			
		||||
        "state": target_state,
 | 
			
		||||
        "force": str(force).lower(),
 | 
			
		||||
        "wait": str(wait).lower(),
 | 
			
		||||
    }
 | 
			
		||||
    response = call_api(
 | 
			
		||||
        config, "post", "/vm/{vm}/state".format(vm=vm), params=params, timeout=120
 | 
			
		||||
        config, "post", "/vm/{vm}/state".format(vm=vm), params=params, timeout=timeout
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    if response.status_code == 200:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user