Submits an action to be performed on a given virtual machine.

    .. versionadded:: 2016.3.0

    name
        The name of the VM to action.

    action
        The action to be performed on the VM. Available options include:
          - boot
          - delete
          - delete-recreate
          - hold
          - poweroff
          - poweroff-hard
          - reboot
          - reboot-hard
          - release
          - resched
          - resume
          - shutdown
          - shutdown-hard
          - stop
          - suspend
          - undeploy
          - undeploy-hard
          - unresched

    CLI Example:

    .. code-block:: bash

        salt-cloud -a vm_action my-vm action='release'

def vm_action(name, kwargs=None, call=None):
    '''
    Submits an action to be performed on a given virtual machine.

    .. versionadded:: 2016.3.0

    name
        The name of the VM to action.

    action
        The action to be performed on the VM. Available options include:
          - boot
          - delete
          - delete-recreate
          - hold
          - poweroff
          - poweroff-hard
          - reboot
          - reboot-hard
          - release
          - resched
          - resume
          - shutdown
          - shutdown-hard
          - stop
          - suspend
          - undeploy
          - undeploy-hard
          - unresched

    CLI Example:

    .. code-block:: bash

        salt-cloud -a vm_action my-vm action='release'
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The vm_action function must be called with -a or --action.'
        )

    if kwargs is None:
        kwargs = {}

    action = kwargs.get('action', None)
    if action is None:
        raise SaltCloudSystemExit(
            'The vm_action function must have an \'action\' provided.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])
    vm_id = int(get_vm_id(kwargs={'name': name}))
    response = server.one.vm.action(auth, action, vm_id)

    data = {
        'action': 'vm.action.' + six.text_type(action),
        'actioned': response[0],
        'vm_id': response[1],
        'error_code': response[2],
    }

    return data