Add disable forcing to CLI

References #148
This commit is contained in:
2021-11-06 04:02:09 -04:00
parent 739b60b91e
commit 5a5e5da663
2 changed files with 17 additions and 6 deletions

View File

@@ -369,7 +369,7 @@ def vm_remove(config, vm, delete_disks=False):
return retstatus, response.json().get("message", "")
def vm_state(config, vm, target_state, wait=False):
def vm_state(config, vm, target_state, force=False, wait=False):
"""
Modify the current state of VM
@@ -377,7 +377,11 @@ def vm_state(config, vm, target_state, wait=False):
API arguments: state={state}, wait={wait}
API schema: {"message":"{data}"}
"""
params = {"state": target_state, "wait": str(wait).lower()}
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)
if response.status_code == 200: