Allow enforcement of live migration

Provides a CLI and API argument to force live migration, which triggers
a new VM state "migrate-live". The node daemon VMInstance during migrate
will read this flag from the state and, if enforced, will not trigger a
shutdown migration.

Closes #95
This commit is contained in:
2020-06-06 11:49:21 -04:00
parent b5434ba744
commit ce60836c34
6 changed files with 72 additions and 32 deletions

View File

@ -203,19 +203,20 @@ def vm_state(config, vm, target_state, wait=False):
return retstatus, response.json()['message']
def vm_node(config, vm, target_node, action, force=False, wait=False):
def vm_node(config, vm, target_node, action, force=False, wait=False, force_live=False):
"""
Modify the current node of VM via {action}
API endpoint: POST /vm/{vm}/node
API arguments: node={target_node}, action={action}, force={force}, wait={wait}
API arguments: node={target_node}, action={action}, force={force}, wait={wait}, force_live={force_live}
API schema: {"message":"{data}"}
"""
params={
'node': target_node,
'action': action,
'force': str(force).lower(),
'wait': str(wait).lower()
'wait': str(wait).lower(),
'force_live': str(force_live).lower()
}
response = call_api(config, 'post', '/vm/{vm}/node'.format(vm=vm), params=params)