Previous topic

The nova.image.fake Module

Next topic

The nova.image.s3 Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.image.glance Module

Implementation of an image service that uses Glance as the backend

class GlanceImageService(client=None)

Bases: object

Provides storage and retrieval of disk image objects within Glance.

create(context, image_meta, data=None)

Store the image data and return the new image id.

Raises :AlreadyExists if the image already exist.
delete(context, image_id)

Delete the given image.

Raises :ImageNotFound if the image does not exist.
Raises :NotAuthorized if the user is not an owner.
delete_all()

Clears out all images.

detail(context, **kwargs)

Calls out to Glance for a list of detailed image information.

get(context, image_id, data)

Calls out to Glance for metadata and data and writes data.

index(context, **kwargs)

Calls out to Glance for a list of images available.

show(context, image_id)

Returns a dict with image data for the given opaque image id.

show_by_name(context, name)

Returns a dict containing image data for the given name.

update(context, image_id, image_meta, data=None)

Replace the contents of the given image with the new data.

Raises :ImageNotFound if the image does not exist.
get_glance_client(context, image_href)

Get the correct glance client and id for the given image_href.

The image_href param can be an href of the form http://myglanceserver:9292/images/42, or just an int such as 42. If the image_href is an int, then flags are used to create the default glance client.

Parameters:image_href – image ref/id for an image
Returns:a tuple of the form (glance_client, image_id)
pick_glance_api_server()

Return which Glance API server to use for the request

This method provides a very primitive form of load-balancing suitable for testing and sandbox environments. In production, it would be better to use one IP and route that to a real load-balancer.

Returns (host, port)