'Create snapshot'

def create_snapshot(self, snapshot):

    volume_name = snapshot.get('volume_id')
    provider_id = snapshot.volume.get('provider_id')
    snapshot_id = snapshot.get('id')
    LOG.debug('Creating    snapshot    %(snap)s    on    volume    %(vol)s', {'snap': snapshot_id, 'vol': volume_name})
    with self._client.open_connection() as api:
        scvolume = api.find_volume(volume_name, provider_id, self._is_live_vol(snapshot))
        if (scvolume is not None):
            replay = api.create_replay(scvolume, snapshot_id, 0)
            if replay:
                return {'status': fields.SnapshotStatus.AVAILABLE, 'provider_id': scvolume['instanceId']}
        else:
            LOG.warning('Unable    to    locate    volume:%s', volume_name)
    snapshot['status'] = fields.SnapshotStatus.ERROR
    msg = (_('Failed    to    create    snapshot    %s') % snapshot_id)
    raise exception.VolumeBackendAPIException(data=msg)
