'Sets the image status to `active` and the image\'s location
attribute.
:param req: The WSGI/Webob Request object
:param image_id: Opaque image identifier
:param location_data: Location of where Glance stored this image'

def _activate(self, req, image_id, location_data, from_state=None):

    image_meta = {'location': location_data['url'], 'status': 'active', 'location_data': [location_data]}
    try:
        s = from_state
        image_meta_data = registry.update_image_metadata(req.context, image_id, image_meta, from_state=s)
        self.notifier.info('image.activate', redact_loc(image_meta_data))
        self.notifier.info('image.update', redact_loc(image_meta_data))
        return image_meta_data
    except exception.Duplicate:
        with excutils.save_and_reraise_exception():
            LOG.debug('duplicate    operation    -    deleting    image    data    for        %(id)s    (location:%(location)s)', {'id': image_id, 'location': image_meta['location']})
            upload_utils.initiate_deletion(req, location_data, image_id)
    except exception.Invalid as e:
        msg = (_('Failed    to    activate    image.    Got    error:    %s') % encodeutils.exception_to_unicode(e))
        LOG.warn(msg)
        raise HTTPBadRequest(explanation=msg, request=req, content_type='text/plain')
