def create_snapshot(kwargs=None, call=None):
    if call != 'function':
        log.error(
            'The show_keypair function must be called with -f or --function.'
        )
        return False

    if not kwargs:
        kwargs = {}

    if 'name' not in kwargs or 'snapshot' not in kwargs:
        log.error('name and snapshot are required arguments')
        return False

    ret = {}
    conn = get_conn()

    vm = conn.get_vm_by_name(kwargs['name'])

    try:
        log.info('Creating snapshot')
        vm.create_snapshot(
            kwargs['snapshot'],
            kwargs.get('description', None),
            kwargs.get('memory', False)
        )

        ret['name'] = kwargs['name']
        ret['snapshot'] = kwargs['snapshot']
        ret['comment'] = 'Snapshot created'
        ret['result'] = True
    except VIException:
        log.error('Unable to create snapshot')

        ret['name'] = kwargs['name']
        ret['snapshot'] = kwargs['snapshot']
        ret['comment'] = 'Failed to create snapshot'
        ret['result'] = False

    return ret
Create a snapshot
dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/vsphere.py/create_snapshot