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.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.

Returns: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, *args, **kwargs)

Detailed information about an images.

Returns: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)

Get an image.

Parameters:data – a file-like object to hold binary image data
Returns:a dict containing image metadata, writes image data to data.
Raises :NotFound if the image does not exist
index(context, *args, **kwargs)

List images.

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

Detailed information about an image.

Returns: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.