glance_store.backend module

class glance_store.backend.Indexable(wrapped, size)

Bases: object

Indexable for file-like objs iterators

Wrapper that allows an iterator or filelike be treated as an indexable data structure. This is required in the case where the return value from Store.get() is passed to Store.add() when adding a Copy-From image to a Store where the client library relies on eventlet GreenSockets, in which case the data to be written is indexed over.

another()

Implemented by subclasses to return the next element.

getvalue()

Return entire string value… used in testing

glance_store.backend.add_to_backend(conf, image_id, data, size, scheme=None, context=None, verifier=None)
glance_store.backend.add_to_backend_with_multihash(conf, image_id, data, size, hashing_algo, scheme=None, context=None, verifier=None)
glance_store.backend.check_location_metadata(val, key='')
glance_store.backend.create_stores(conf=<oslo_config.cfg.ConfigOpts object>)

Registers all store modules and all schemes from the given config. Duplicates are not re-registered.

glance_store.backend.delete_from_backend(uri, context=None)

Removes chunks of data from backend specified by uri.

glance_store.backend.get_from_backend(uri, offset=0, chunk_size=None, context=None)

Yields chunks of data from backend specified by uri.

glance_store.backend.get_known_schemes()

Returns list of known schemes.

glance_store.backend.get_size_from_backend(uri, context=None)

Retrieves image size from backend specified by uri.

glance_store.backend.get_store_from_location(uri)

Given a location (assumed to be a URL), attempt to determine the store from the location. We use here a simple guess that the scheme of the parsed URL is the store…

Parameters

uri – Location to check for the store

glance_store.backend.get_store_from_scheme(scheme)

Given a scheme, return the appropriate store object for handling that scheme.

glance_store.backend.get_store_from_uri(uri)

Given a URI, return the store object that would handle operations on the URI.

Parameters

uri – URI to analyze

glance_store.backend.register_opts(conf)
glance_store.backend.set_acls(location_uri, public=False, read_tenants=[], write_tenants=None, context=None)
glance_store.backend.store_add_to_backend(image_id, data, size, store, context=None, verifier=None)

A wrapper around a call to each stores add() method. This gives glance a common place to check the output

Parameters
  • image_id – The image add to which data is added

  • data – The data to be stored

  • size – The length of the data in bytes

  • store – The store to which the data is being added

  • context – The request context

  • verifier – An object used to verify signatures for images

Returns

The url location of the file, the size amount of data, the checksum of the data the storage systems metadata dictionary for the location

glance_store.backend.store_add_to_backend_with_multihash(image_id, data, size, hashing_algo, store, context=None, verifier=None)

A wrapper around a call to each store’s add() method that requires a hashing_algo identifier and returns a 5-tuple including the “multihash” computed using the specified hashing_algo. (This is an enhanced version of store_add_to_backend(), which is left as-is for backward compatibility.)

Parameters
  • image_id – The image add to which data is added

  • data – The data to be stored

  • size – The length of the data in bytes

  • store – The store to which the data is being added

  • hashing_algo – A hashlib algorithm identifier (string)

  • context – The request context

  • verifier – An object used to verify signatures for images

Returns

The url location of the file, the size amount of data, the checksum of the data, the multihash of the data, the storage system’s metadata dictionary for the location

Raises

glance_store.exceptions.BackendException glance_store.exceptions.UnknownHashingAlgo

glance_store.backend.verify_default_store()