glance_store.driver module

Base class for all storage backends

class glance_store.driver.Store(conf, backend=None)

Bases: StoreCapability

MULTI_BACKEND_OPTIONS = [<oslo_config.cfg.StrOpt object>, <oslo_config.cfg.IntOpt object>]
OPTIONS = None
READ_CHUNKSIZE = 4194304
WRITE_CHUNKSIZE = 4194304
add(*args, **kwargs)
configure(re_raise_bsc=False)

Configure the store to use the stored configuration options and initialize capabilities based on current configuration.

Any store that needs special configuration should implement this method.

configure_add()

This is like configure except that it’s specifically for configuring the store to accept objects.

If the store was not able to successfully configure itself, it should raise exceptions.BadStoreConfiguration.

delete(*args, **kwargs)
get(*args, **kwargs)
get_schemes()

Returns a tuple of schemes which this store can handle.

get_size(location, context=None)

Takes a glance_store.location.Location object that indicates where to find the image file, and returns the size

Parameters:

locationglance_store.location.Location object, supplied from glance_store.location.get_location_from_uri()

Raises:

glance_store.exceptions.NotFound if image does not exist

get_store_location_class()

Returns the store location class that is used by this store.

set_acls(location, public=False, read_tenants=None, write_tenants=None, context=None)

Sets the read and write access control list for an image in the backend store.

Parameters:
  • locationglance_store.location.Location object, supplied from glance_store.location.get_location_from_uri()

  • public – A boolean indicating whether the image should be public.

  • read_tenants – A list of tenant strings which should be granted read access for an image.

  • write_tenants – A list of tenant strings which should be granted write access for an image.

property url_prefix
property weight
glance_store.driver.back_compat_add(store_add_fun)

Provides backward compatibility for the 0.26.0+ Store.add() function. In 0.26.0, the ‘hashing_algo’ parameter is introduced and Store.add() returns a 5-tuple containing a computed ‘multihash’ value.

This wrapper behaves as follows:

If no hashing_algo identifier is supplied as an argument, the response is the pre-0.26.0 4-tuple of:

(backend_url, bytes_written, checksum, metadata_dict)

If a hashing_algo is supplied, the response is a 5-tuple:

(backend_url, bytes_written, checksum, multihash, metadata_dict)

The wrapper detects the presence of a ‘hashing_algo’ argument both by examining named arguments and positionally.