glance.registry.api.v1 package

Submodules

glance.registry.api.v1.images module

Reference implementation registry server WSGI controller

class glance.registry.api.v1.images.Controller[source]

Bases: object

create(req, *args, **kwargs)[source]

Registers a new image with the registry.

Parameters:
  • req – wsgi Request object
  • 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

delete(req, *args, **kwargs)[source]

Deletes an existing image with the registry.

Parameters:
  • req – wsgi Request object
  • id – The opaque internal identifier for the image
Returns:

200 if delete was successful, a fault if not. On success, the body contains the deleted image information as a mapping.

detail(req)[source]

Return a filtered list of public, non-deleted images in detail

Parameters:req – the Request object coming from the wsgi layer
Returns:a mapping of the following form
{'images':
    [{
        'id': <ID>,
        'name': <NAME>,
        'size': <SIZE>,
        'disk_format': <DISK_FORMAT>,
        'container_format': <CONTAINER_FORMAT>,
        'checksum': <CHECKSUM>,
        'min_disk': <MIN_DISK>,
        'min_ram': <MIN_RAM>,
        'store': <STORE>,
        'status': <STATUS>,
        'created_at': <TIMESTAMP>,
        'updated_at': <TIMESTAMP>,
        'deleted_at': <TIMESTAMP>|<NONE>,
        'properties': {'distro': 'Ubuntu 10.04 LTS', {...}}
    }, {...}]
}
index(req)[source]

Return a basic filtered list of public, non-deleted images

Parameters:req – the Request object coming from the wsgi layer
Returns:a mapping of the following form
dict(images=[image_list])

Where image_list is a sequence of mappings

{
    'id': <ID>,
    'name': <NAME>,
    'size': <SIZE>,
    'disk_format': <DISK_FORMAT>,
    'container_format': <CONTAINER_FORMAT>,
    'checksum': <CHECKSUM>
}
show(req, id)[source]

Return data about the given image id.

update(req, *args, **kwargs)[source]

Updates an existing image with the registry.

Parameters:
  • req – wsgi Request object
  • body – Dictionary of information about the image
  • id – The opaque internal identifier for the image
Returns:

Returns the updated image information as a mapping,

glance.registry.api.v1.images.create_resource()[source]

Images resource factory method.

glance.registry.api.v1.images.make_image_dict(image)[source]

Create a dict representation of an image which we can use to serialize the image.

glance.registry.api.v1.members module

class glance.registry.api.v1.members.Controller[source]

Bases: object

default(req, *args, **kwargs)[source]

This will cover the missing ‘show’ and ‘create’ actions

delete(req, *args, **kwargs)[source]

Removes a membership from the image.

index(req, image_id)[source]

Get the members of an image.

index_shared_images(req, id)[source]

Retrieves images shared with the given member.

is_image_sharable(context, image)[source]

Return True if the image can be shared to others in this context.

update(req, *args, **kwargs)[source]

Adds a membership to the image, or updates an existing one. If a body is present, it is a dict with the following format:

{'member': {
    'can_share': [True|False]
}}

If can_share is provided, the member’s ability to share is set accordingly. If it is not provided, existing memberships remain unchanged and new memberships default to False.

update_all(req, *args, **kwargs)[source]

Replaces the members of the image with those specified in the body. The body is a dict with the following format:

{'memberships': [
    {'member_id': <MEMBER_ID>,
     ['can_share': [True|False]]}, ...
]}
glance.registry.api.v1.members.create_resource()[source]

Image members resource factory method.

glance.registry.api.v1.members.make_member_list(members, **attr_map)[source]

Create a dict representation of a list of members which we can use to serialize the members list. Keyword arguments map the names of optional attributes to include to the database attribute.

Module contents

class glance.registry.api.v1.API(mapper)[source]

Bases: glance.common.wsgi.Router

WSGI entry point for all Registry requests.

glance.registry.api.v1.init(mapper)[source]