'Creates an entry in the transfers table.'

def create(self, context, volume_id, display_name):

    volume_api.check_policy(context, 'create_transfer')
    LOG.info('Generating    transfer    record    for    volume    %s', volume_id)
    volume_ref = self.db.volume_get(context, volume_id)
    if (volume_ref['status'] != 'available'):
        raise exception.InvalidVolume(reason=_('status    must    be    available'))
    volume_utils.notify_about_volume_usage(context, volume_ref, 'transfer.create.start')
    salt = self._get_random_string(CONF.volume_transfer_salt_length)
    auth_key = self._get_random_string(CONF.volume_transfer_key_length)
    crypt_hash = self._get_crypt_hash(salt, auth_key)
    transfer_rec = {'volume_id': volume_id, 'display_name': display_name, 'salt': salt, 'crypt_hash': crypt_hash, 'expires_at': None}
    try:
        transfer = self.db.transfer_create(context, transfer_rec)
    except Exception:
        LOG.error('Failed    to    create    transfer    record    for    %s', volume_id)
        raise
    volume_utils.notify_about_volume_usage(context, volume_ref, 'transfer.create.end')
    return {'id': transfer['id'], 'volume_id': transfer['volume_id'], 'display_name': transfer['display_name'], 'auth_key': auth_key, 'created_at': transfer['created_at']}
