The nova.image.glance Module

Implementation of an image service that uses Glance as the backend.

class GlanceClientWrapper(context=None, endpoint=None, version=1)

Bases: object

Glance client wrapper class that implements retries.

call(context, version, 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.

create(context, image_meta, data=None)

Store the image data and return the new image object.

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.
Raises:ImageNotAuthorized if the user is not authorized.
detail(context, **kwargs)

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

download(context, image_id, data=None, dst_path=None)

Calls out to Glance for data and writes data.

show(context, image_id, include_locations=False, show_deleted=True)

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

Parameters:
  • context – The context object to pass to image client
  • image_id – The UUID of the image
  • include_locations – (Optional) include locations in the returned dict of information if the image service API supports it. If the image service API does not support the locations attribute, it will still be included in the returned dict, as an empty list.
  • show_deleted – (Optional) show the image even the status of image is deleted.
update(context, image_id, image_meta, data=None, purge_props=True)

Modify the given image with the new data.

class UpdateGlanceImage(context, image_id, metadata, stream)

Bases: object

start()
generate_glance_url()

Generate the URL to glance.

generate_identity_headers(context, status='Confirmed')
generate_image_url(image_ref)

Generate an image URL from an image_ref.

get_api_servers()

Shuffle a list of CONF.glance.api_servers and return an iterator that will cycle through the list, looping around to the beginning if necessary.

get_default_image_service()
get_remote_image_service(context, image_href)

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

The image_href param can be an href of the form ‘http://example.com:9292/v1/images/b8b2c6f7-7345-4e2f-afa2-eedaba9cbbe3‘, 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.

Parameters:image_href – href that describes the location of an image
Returns:a tuple of the form (image_service, image_id)

Previous topic

The nova.image.download.file Module

Next topic

The nova.image.s3 Module

Project Source

This Page