'Safely uploads the image data in the request payload
and activates the image in the registry after a successful
upload.
:param req: The WSGI/Webob Request object
:param image_meta: Mapping of metadata about image
:returns: Mapping of updated image data'

def _upload_and_activate(self, req, image_meta):

    location_data = self._upload(req, image_meta)
    image_id = image_meta['id']
    LOG.info(_LI('Uploaded    data    of    image    %s    from    request    payload    successfully.'), image_id)
    if location_data:
        try:
            image_meta = self._activate(req, image_id, location_data, from_state='saving')
        except exception.Duplicate:
            raise
        except Exception:
            with excutils.save_and_reraise_exception():
                LOG.warn((_LW("Failed    to    activate    image    %s    in    registry.    About    to    delete    image    bits    from    store    and    update    status    to    'killed'.") % image_id))
                upload_utils.initiate_deletion(req, location_data, image_id)
                upload_utils.safe_kill(req, image_id, 'saving')
    else:
        image_meta = None
    return image_meta
