Implement VM rename functionality

Closes #125
This commit is contained in:
2021-05-23 16:41:42 -04:00
parent 9de14c46fb
commit f46c2e7f6a
6 changed files with 204 additions and 0 deletions

View File

@ -130,6 +130,27 @@ def vm_modify(config, vm, xml, restart):
return retstatus, response.json().get('message', '')
def vm_rename(config, vm, new_name):
"""
Rename VM to new name
API endpoint: POST /vm/{vm}/rename
API arguments: new_name={new_name}
API schema: {"message":"{data}"}
"""
params = {
'new_name': new_name
}
response = call_api(config, 'post', '/vm/{vm}/rename'.format(vm=vm), params=params)
if response.status_code == 200:
retstatus = True
else:
retstatus = False
return retstatus, response.json().get('message', '')
def vm_metadata(config, vm, node_limit, node_selector, node_autostart, migration_method, provisioner_profile):
"""
Modify PVC metadata of a VM