Implement VM rollback

Closes #184
This commit is contained in:
2024-08-05 13:21:41 -04:00
parent 174e6e08e3
commit 33f905459a
5 changed files with 186 additions and 3 deletions

View File

@ -538,6 +538,25 @@ def vm_remove_snapshot(config, vm, snapshot_name):
return True, response.json().get("message", "")
def vm_rollback_snapshot(config, vm, snapshot_name):
"""
Roll back to a snapshot of a VM's disks and configuration
API endpoint: POST /vm/{vm}/snapshot/rollback
API arguments: snapshot_name=snapshot_name
API schema: {"message":"{data}"}
"""
params = {"snapshot_name": snapshot_name}
response = call_api(
config, "post", "/vm/{vm}/snapshot/rollback".format(vm=vm), params=params
)
if response.status_code != 200:
return False, response.json().get("message", "")
else:
return True, response.json().get("message", "")
def vm_vcpus_set(config, vm, vcpus, topology, restart):
"""
Set the vCPU count of the VM with topology