'Export all volume backup metadata details to allow clean import.
Export backup metadata so it could be re-imported into the database
without any prerequisite in the backup database.
:param context: running context
:param backup: backup object to export
:returns: backup_record - a description of how to import the backup
:returns: contains \'backup_url\' - how to import the backup, and
:returns: \'backup_service\' describing the needed driver.
:raises InvalidBackup:'

def export_record(self, context, backup):

    LOG.info('Export    record    started,    backup:    %s.', backup.id)
    expected_status = fields.BackupStatus.AVAILABLE
    actual_status = backup.status
    if (actual_status != expected_status):
        err = (_('Export    backup    aborted,    expected    backup    status    %(expected_status)s    but    got    %(actual_status)s.') % {'expected_status': expected_status, 'actual_status': actual_status})
        raise exception.InvalidBackup(reason=err)
    backup_record = {'backup_service': backup.service}
    backup_service = self._map_service_to_driver(backup.service)
    configured_service = self.driver_name
    if (backup_service != configured_service):
        err = (_('Export    record    aborted,    the    backup    service    currently    configured    [%(configured_service)s]    is    not    the    backup    service    that    was    used    to    create    this    backup    [%(backup_service)s].') % {'configured_service': configured_service, 'backup_service': backup_service})
        raise exception.InvalidBackup(reason=err)
    try:
        backup_service = self.service.get_backup_driver(context)
        driver_info = backup_service.export_record(backup)
        backup_url = backup.encode_record(driver_info=driver_info)
        backup_record['backup_url'] = backup_url
    except Exception as err:
        msg = six.text_type(err)
        raise exception.InvalidBackup(reason=msg)
    LOG.info('Export    record    finished,    backup    %s    exported.', backup.id)
    return backup_record
