From 21b4bbe51ad687793a98b8512a9598a91eee28c5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sat, 6 Nov 2021 13:26:55 -0400 Subject: [PATCH] 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). --- client-cli/pvc/cli_lib/vm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client-cli/pvc/cli_lib/vm.py b/client-cli/pvc/cli_lib/vm.py index ba51fec0..c94ea5b2 100644 --- a/client-cli/pvc/cli_lib/vm.py +++ b/client-cli/pvc/cli_lib/vm.py @@ -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: