glance.cmd package¶
Submodules¶
glance.cmd.api module¶
Glance API Server
glance.cmd.cache_cleaner module¶
Glance Image Cache Invalid Cache Entry and Stalled Image cleaner
This is meant to be run as a periodic task from cron.
If something goes wrong while we’re caching an image (for example the fetch times out, or an exception is raised), we create an ‘invalid’ entry. These entires are left around for debugging purposes. However, after some period of time, we want to clean these up.
Also, if an incomplete image hangs around past the image_cache_stall_time period, we automatically sweep it up.
glance.cmd.cache_manage module¶
A simple cache management utility for Glance.
-
glance.cmd.cache_manage.
catch_error
(action)[source]¶ Decorator to provide sensible default error handling for actions.
-
glance.cmd.cache_manage.
create_options
(parser)[source]¶ Set up the CLI and config-file options that may be parsed and program commands.
Parameters: parser – The option parser
-
glance.cmd.cache_manage.
delete_all_cached_images
(*args, **kwargs)[source]¶ %(prog)s delete-all-cached-images [options]
Remove all images from the cache.
-
glance.cmd.cache_manage.
delete_all_queued_images
(*args, **kwargs)[source]¶ %(prog)s delete-all-queued-images [options]
Remove all images from the cache queue.
-
glance.cmd.cache_manage.
delete_cached_image
(*args, **kwargs)[source]¶ %(prog)s delete-cached-image <IMAGE_ID> [options]
Deletes an image from the cache
-
glance.cmd.cache_manage.
delete_queued_image
(*args, **kwargs)[source]¶ %(prog)s delete-queued-image <IMAGE_ID> [options]
Deletes an image from the cache
-
glance.cmd.cache_manage.
env
(*vars, **kwargs)[source]¶ Search for the first defined of possibly many env vars.
Returns the first environment variable defined in vars, or returns the default defined in kwargs.
-
glance.cmd.cache_manage.
get_client
(options)[source]¶ Return a new client object to a Glance server.
specified by the –host and –port options supplied to the CLI
-
glance.cmd.cache_manage.
list_cached
(*args, **kwargs)[source]¶ %(prog)s list-cached [options]
List all images currently cached.
-
glance.cmd.cache_manage.
list_queued
(*args, **kwargs)[source]¶ %(prog)s list-queued [options]
List all images currently queued for caching.
-
glance.cmd.cache_manage.
parse_options
(parser, cli_args)[source]¶ Returns the parsed CLI options, command to run and its arguments, merged with any same-named options found in a configuration file
Parameters: parser – The option parser
glance.cmd.cache_prefetcher module¶
Glance Image Cache Pre-fetcher
This is meant to be run from the command line after queueing images to be pretched.
glance.cmd.cache_pruner module¶
Glance Image Cache Pruner
This is meant to be run as a periodic task, perhaps every half-hour.
glance.cmd.control module¶
Helper script for starting/stopping/reloading Glance server programs. Thanks for some of the code, Swifties ;)
glance.cmd.glare module¶
Glare (Glance Artifact Repository) API service
glance.cmd.manage module¶
Glance Management Utility
-
class
glance.cmd.manage.
DbCommands
[source]¶ Bases:
object
Class for managing the db
-
load_metadefs
(path=None, merge=False, prefer_new=False, overwrite=False)[source]¶ Load metadefinition json files to database
-
glance.cmd.registry module¶
Reference implementation server for Glance Registry
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.
-
-
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.
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 master glance instance. toserver:port: the location of the slave 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 master glance instance. toserver:port: the location of the slave glance instance.