cinder.image.glance module

Implementation of an image service that uses Glance as the backend

class GlanceClientWrapper(context=None, netloc=None, use_ssl=False)

Bases: object

Glance client wrapper class that implements retries.

call(context, method, *args, **kwargs)

Call a glance client method.

If we get a connection error, retry the request according to CONF.glance_num_retries.

class GlanceImageService(client=None)

Bases: object

Provides storage and retrieval of disk image objects within Glance.

add_location(context, image_id, url, metadata)

Add a backend location url to an image.

Returns a dict containing image metadata on success.

create(context, image_meta, data=None)

Store the image data and return the new image object.

delete(context, image_id)

Delete the given image.

detail(context, **kwargs)

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

download(context, image_id, data=None)

Calls out to Glance for data and writes data.

get_location(context, image_id)

Get backend storage location url.

Returns a tuple containing the direct url and locations representing the backend storage location, or (None, None) if these attributes are not shown by Glance.


Returns a list of dicts with stores information.

list_members(context, image_id)

Returns a list of dicts with image member data.

show(context, image_id)

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

update(context, image_id, image_meta, data=None, purge_props=True, store_id=None, base_image_ref=None)

Modify the given image with the new data.


Return Iterable over shuffled api servers.

Shuffle a list of glance_api_servers and return an iterator that will cycle through the list, looping around to the beginning if necessary. If CONF.glance_api_servers is None then they will be retrieved from the catalog.

get_remote_image_service(context: cinder.context.RequestContext, image_href)Tuple[cinder.image.glance.GlanceImageService, str]

Create an image_service and parse the id from the given image_href.

The image_href param can be an href of the form ‘’, or just an id such as ‘b8b2c6f7-7345-4e2f-afa2-eedaba9cbbe3’. If the image_href is a standalone id, then the default image service is returned.


image_href – href that describes the location of an image


a tuple of the form (image_service, image_id)