'Uploads the payload of the request to a backend store in
Glance. If the `x-image-meta-store` header is set, Glance
will attempt to use that scheme; if not, Glance will use the
scheme set by the flag `default_store` to find the backing store.
:param req: The WSGI/Webob Request object
:param image_meta: Mapping of metadata about image
:raises HTTPConflict: if image already exists
:returns: The location where the image was stored'

def _upload(self, req, image_meta):

    scheme = req.headers.get('x-image-meta-store', CONF.glance_store.default_store)
    store = self.get_store_or_400(req, scheme)
    copy_from = self._copy_from(req)
    if copy_from:
        try:
            (image_data, image_size) = self._get_from_store(req.context, copy_from, dest=store)
        except Exception:
            upload_utils.safe_kill(req, image_meta['id'], 'queued')
            msg = (_LE("Copy    from    external    source    '%(scheme)s'    failed    for    image:    %(image)s") % {'scheme': scheme, 'image': image_meta['id']})
            LOG.exception(msg)
            return
        image_meta['size'] = (image_size or image_meta['size'])
    else:
        try:
            req.get_content_type(('application/octet-stream',))
        except exception.InvalidContentType:
            upload_utils.safe_kill(req, image_meta['id'], 'queued')
            msg = _('Content-Type    must    be    application/octet-stream')
            LOG.warn(msg)
            raise HTTPBadRequest(explanation=msg)
        image_data = req.body_file
    image_id = image_meta['id']
    LOG.debug("Setting    image    %s    to    status    'saving'", image_id)
    registry.update_image_metadata(req.context, image_id, {'status': 'saving'})
    LOG.debug('Uploading    image    data    for    image    %(image_id)s    to    %(scheme)s    store', {'image_id': image_id, 'scheme': scheme})
    self.notifier.info('image.prepare', redact_loc(image_meta))
    (image_meta, location_data) = upload_utils.upload_data_to_store(req, image_meta, image_data, store, self.notifier)
    self.notifier.info('image.upload', redact_loc(image_meta))
    return location_data
