Implementation of an image service that uses Glance as the backend
GlanceClientWrapper
(context: Optional[cinder.context.RequestContext] = None, netloc: Optional[str] = None, use_ssl: bool = False)¶Bases: object
Glance client wrapper class that implements retries.
call
(context: cinder.context.RequestContext, method: str, *args: Any, **kwargs: str) → Any¶Call a glance client method.
If we get a connection error, retry the request according to CONF.glance_num_retries.
GlanceImageService
(client: Optional[Any] = None)¶Bases: object
Provides storage and retrieval of disk image objects within Glance.
add_location
(context: cinder.context.RequestContext, image_id: str, url: str, metadata: dict) → dict¶Add a backend location url to an image.
Returns a dict containing image metadata on success.
create
(context: cinder.context.RequestContext, image_meta: dict, data=None) → dict¶Store the image data and return the new image object.
delete
(context: cinder.context.RequestContext, image_id: str) → bool¶Delete the given image.
ImageNotFound – if the image does not exist.
NotAuthorized – if the user is not an owner.
detail
(context: cinder.context.RequestContext, **kwargs: str) → list¶Calls out to Glance for a list of detailed image information.
download
(context: cinder.context.RequestContext, image_id: str, data=None)¶Calls out to Glance for data and writes data.
get_location
(context: cinder.context.RequestContext, image_id: str) → tuple¶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.
get_stores
(context: cinder.context.RequestContext)¶Returns a list of dicts with stores information.
list_members
(context: cinder.context.RequestContext, image_id: str) → list¶Returns a list of dicts with image member data.
show
(context: cinder.context.RequestContext, image_id: str) → dict¶Returns a dict with image data for the given opaque image id.
update
(context: cinder.context.RequestContext, image_id: str, image_meta: dict, data=None, purge_props: bool = True, store_id: Optional[str] = None, base_image_ref: Optional[str] = None) → dict¶Modify the given image with the new data.
get_api_servers
(context: cinder.context.RequestContext) → Iterable¶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_default_image_service
() → cinder.image.glance.GlanceImageService¶get_remote_image_service
(context: cinder.context.RequestContext, image_href) → tuple¶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.
image_href – href that describes the location of an image
a tuple of the form (image_service, image_id)
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.