'Registers a new image with the registry.
:param req: wsgi Request object
:param body: Dictionary of information about the image
:returns: The newly-created image information as a mapping,
which will include the newly-created image\'s internal id
in the \'id\' field'

@utils.mutating
def create(self, req, body):

    image_data = body['image']
    image_data.setdefault('status', 'active')
    if ((not req.context.is_admin) or ('owner' not in image_data)):
        image_data['owner'] = req.context.owner
    image_id = image_data.get('id')
    if (image_id and (not uuidutils.is_uuid_like(image_id))):
        LOG.info(_LI("Rejecting    image    creation    request    for    invalid    image    id    '%(bad_id)s'"), {'bad_id': image_id})
        msg = _('Invalid    image    id    format')
        return exc.HTTPBadRequest(explanation=msg)
    if ('location' in image_data):
        image_data['locations'] = [image_data.pop('location')]
    try:
        image_data = _normalize_image_location_for_db(image_data)
        image_data = self.db_api.image_create(req.context, image_data, v1_mode=True)
        image_data = dict(image=make_image_dict(image_data))
        LOG.info(_LI('Successfully    created    image    %(id)s'), {'id': image_data['image']['id']})
        return image_data
    except exception.Duplicate:
        msg = (_('Image    with    identifier    %s    already    exists!') % image_id)
        LOG.warn(msg)
        return exc.HTTPConflict(msg)
    except exception.Invalid as e:
        msg = (_('Failed    to    add    image    metadata.    Got    error:    %s') % encodeutils.exception_to_unicode(e))
        LOG.error(msg)
        return exc.HTTPBadRequest(msg)
    except Exception:
        LOG.exception(_LE('Unable    to    create    image    %s'), image_id)
        raise
