'Prepare the backup process and return the backup metadata.'

def _prepare_backup(self, backup):

    volume = self.db.volume_get(self.context, backup.volume_id)
    if (volume['size'] <= 0):
        err = (_('volume    size    %d    is    invalid.') % volume['size'])
        raise exception.InvalidVolume(reason=err)
    container = self._create_container(backup)
    object_prefix = self._generate_object_name_prefix(backup)
    backup.service_metadata = object_prefix
    backup.save()
    volume_size_bytes = (volume['size'] * units.Gi)
    availability_zone = self.az
    LOG.debug('starting    backup    of    volume:    %(volume_id)s,    volume    size:    %(volume_size_bytes)d,    object    names    prefix    %(object_prefix)s,    availability    zone:    %(availability_zone)s', {'volume_id': backup.volume_id, 'volume_size_bytes': volume_size_bytes, 'object_prefix': object_prefix, 'availability_zone': availability_zone})
    object_meta = {'id': 1, 'list': [], 'prefix': object_prefix, 'volume_meta': None}
    object_sha256 = {'id': 1, 'sha256s': [], 'prefix': object_prefix}
    extra_metadata = self.get_extra_metadata(backup, volume)
    if (extra_metadata is not None):
        object_meta['extra_metadata'] = extra_metadata
    return (object_meta, object_sha256, extra_metadata, container, volume_size_bytes)
