'Create a snapshot from a volume_group.'

@kaminario_logger
def create_snapshot(self, snapshot):

    vg_name = self.get_volume_group_name(snapshot.volume_id)
    snap_name = self.get_snap_name(snapshot.id)
    rpolicy = self.get_policy()
    try:
        LOG.debug('Searching    volume_group:    %s    in    K2.', vg_name)
        vg = self.client.search('volume_groups', name=vg_name).hits[0]
        LOG.debug('Creating    a    snapshot:    %(snap)s    from    vg:    %(vg)s', {'snap': snap_name, 'vg': vg_name})
        self.client.new('snapshots', short_name=snap_name, source=vg, retention_policy=rpolicy, is_auto_deleteable=False).save()
    except Exception as ex:
        LOG.exception('Creation    of    snapshot:    %s    failed.', snap_name)
        raise exception.KaminarioCinderDriverException(reason=ex)
