glance.cmd.replicator module

class glance.cmd.replicator.ImageService(conn, auth_token)[source]

Bases: object

add_image(image_meta, image_data)[source]

Upload an image.

image_meta: image metadata as a dictionary image_data: image data as a object with a read() method

Returns: a tuple of (http response headers, http response body)

add_image_meta(image_meta)[source]

Update image metadata.

image_meta: image metadata as a dictionary

Returns: a tuple of (http response headers, http response body)

get_image(image_uuid)[source]

Fetch image data from glance.

image_uuid: the id of an image

Returns: a http_client Response object where the body is the image.

get_image_meta(image_uuid)[source]

Return the metadata for a single image.

image_uuid: the id of an image

Returns: image metadata as a dictionary

get_images()[source]

Return a detailed list of images.

Yields a series of images as dicts containing metadata.

glance.cmd.replicator.get_image_service()[source]

Get a copy of the image service.

This is done like this to make it easier to mock out ImageService.

glance.cmd.replicator.lookup_command(command_name)[source]

Lookup a command.

command_name: the command name

Returns: a method which implements that command

glance.cmd.replicator.main()[source]

The main function.

glance.cmd.replicator.print_help(options, args)[source]

Print help specific to a command.

options: the parsed command line options args: the command line

glance.cmd.replicator.replication_compare(options, args)[source]

%(prog)s compare <fromserver:port> <toserver:port>

Compare the contents of fromserver with those of toserver.

fromserver:port: the location of the source glance instance. toserver:port: the location of the target glance instance.

glance.cmd.replicator.replication_dump(options, args)[source]

%(prog)s dump <server:port> <path>

Dump the contents of a glance instance to local disk.

server:port: the location of the glance instance. path: a directory on disk to contain the data.

glance.cmd.replicator.replication_livecopy(options, args)[source]

%(prog)s livecopy <fromserver:port> <toserver:port>

Load the contents of one glance instance into another.

fromserver:port: the location of the source glance instance. toserver:port: the location of the target glance instance.

glance.cmd.replicator.replication_load(options, args)[source]

%(prog)s load <server:port> <path>

Load the contents of a local directory into glance.

server:port: the location of the glance instance. path: a directory on disk containing the data.

glance.cmd.replicator.replication_size(options, args)[source]

%(prog)s size <server:port>

Determine the size of a glance instance if dumped to disk.

server:port: the location of the glance instance.