This Page

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

The nova.image.service Module

class nova.image.service.BaseImageService

Bases: object

Base class for providing image search and retrieval services

ImageService exposes two concepts of metadata:

  1. First-class attributes: This is metadata that is common to all ImageService subclasses and is shared across all hypervisors. These attributes are defined by IMAGE_ATTRS.
  2. Properties: This is metdata that is specific to an ImageService, and Image, or a particular hypervisor. Any attribute not present in BASE_IMAGE_ATTRS should be considered an image property.

This means that ImageServices will return BASE_IMAGE_ATTRS as keys in the metadata dict, all other attributes will be returned as keys in the nested ‘properties’ dict.

create(context, metadata, data=None)

Store the image metadata and data and return the new image metadata.

:raises AlreadyExists if the image already exist.

delete(context, image_id)

Delete the given image.

:raises NotFound if the image does not exist.

detail(context)

Returns a sequence of mappings of detailed information about images.

Return type:

array

Retval :

a sequence of mappings with the following signature {‘id’: opaque id of image,

‘name’: name of image, ‘created_at’: creation datetime object, ‘updated_at’: modification datetime object, ‘deleted_at’: deletion datetime object or None, ‘deleted’: boolean indicating if image has been deleted, ‘status’: string description of image status, ‘is_public’: boolean indicating if image is public }

If the service does not implement a method that provides a detailed set of information about images, then the method should raise NotImplementedError, in which case Nova will emulate this method with repeated calls to show() for each image received from the index() method.

get(context, data)

Returns a dict containing image metadata and writes image data to data.

Parameters:
  • data – a file-like object to hold binary image data

:raises NotFound if the image does not exist

index(context)

Returns a sequence of mappings of id and name information about images.

Return type:array
Retval :a sequence of mappings with the following signature {‘id’: opaque id of image, ‘name’: name of image}
show(context, image_id)

Returns a dict containing image metadata for the given opaque image id.

Retval a mapping with the following signature:
 
{‘id’: opaque id of image,

‘name’: name of image, ‘created_at’: creation datetime object, ‘updated_at’: modification datetime object, ‘deleted_at’: deletion datetime object or None, ‘deleted’: boolean indicating if image has been deleted, ‘status’: string description of image status, ‘is_public’: boolean indicating if image is public }, ...

:raises NotFound if the image does not exist

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

Update the given image metadata and data and return the metadata

:raises NotFound if the image does not exist.