glance_store.multi_backend module¶
- glance_store.multi_backend.add(conf, image_id, data, size, backend, context=None, verifier=None)¶
- glance_store.multi_backend.add_with_multihash(conf, image_id, data, size, backend, hashing_algo, scheme=None, context=None, verifier=None)¶
- glance_store.multi_backend.check_location_metadata(val, key='')¶
- glance_store.multi_backend.create_multi_stores(conf=<oslo_config.cfg.ConfigOpts object>, reserved_stores=None)¶
Registers all store modules and all schemes from the given configuration object.
- Parameters
conf – A oslo_config (or compatible) object
reserved_stores – A list of stores for the consuming service’s internal use. The list must be the same format as the
enabled_backends
configuration setting. The default value is None
- Returns
The number of stores configured
- Raises
glance_store.exceptions.BackendException
Configuring Multiple Backends
The backends to be configured are expected to be found in the
enabled_backends
configuration variable in the DEFAULT group of the object. The format for the variable is a dictionary of key:value pairs where the key is an arbitrary store identifier and the value is the store type identifier for the store.The type identifiers must be defined in the
[entry points]
section of the glance_storesetup.cfg
file as values for theglance_store.drivers
configuration. (See the defaultsetup.cfg
file for an example.) The store type identifiers for the currently supported drivers are already defined in the file.Thus an example value for
enabled_backends
is:{'store_one': 'http', 'store_two': 'file', 'store_three': 'rbd'}
The
reserved_stores
parameter, if included, must have the same format. There is no difference between theenabled_backends
andreserved_stores
from the glance_store point of view: the reserved stores are a convenience for the consuming service, which may wish to handle the two sets of stores differently.The Default Store
If you wish to set a default store, its store identifier should be defined as the value of the
default_backend
configuration option in theglance_store
group of theconf
parameter. The store identifier, or course, should be specified as one of the keys in theenabled_backends
dict. It is recommended that a default store be set.Configuring Individual Backends
To configure each store mentioned in the
enabled_backends
configuration option, you must define an option group with the same name as the store identifier. The options defined for that backend will depend upon the store type; consult the documentation for the appropriate backend driver to determine what these are.For example, given the
enabled_backends
example above, you would put the following in the configuration file that loads theconf
object:[DEFAULT] enabled_backends = store_one:rbd,store_two:file,store_three:http [store_one] store_description = "A human-readable string aimed at end users" rbd_store_chunk_size = 8 rbd_store_pool = images rbd_store_user = admin rbd_store_ceph_conf = /etc/ceph/ceph.conf [store_two] store_description = "Human-readable description of this store" filesystem_store_datadir = /opt/stack/data/glance/store_two [store_three] store_description = "A read-only store" https_ca_certificates_file = /opt/stack/certs/gs.cert [glance_store] default_backend = store_two
The
store_description
options may be used by a consuming service. As recommended above, this file also defines a default backend.
- glance_store.multi_backend.delete(uri, backend, context=None)¶
Removes chunks of data from backend specified by uri.
- glance_store.multi_backend.get(uri, backend, offset=0, chunk_size=None, context=None)¶
Yields chunks of data from backend specified by uri.
- glance_store.multi_backend.get_known_schemes_for_multi_store()¶
Returns list of known schemes.
- glance_store.multi_backend.get_size_from_uri_and_backend(uri, backend, context=None)¶
Retrieves image size from backend specified by uri.
- glance_store.multi_backend.get_store_from_store_identifier(store_identifier)¶
Determine backing store from identifier.
Given a store identifier, return the appropriate store object for handling that scheme.
- glance_store.multi_backend.register_store_opts(conf, reserved_stores=None)¶
- glance_store.multi_backend.set_acls_for_multi_store(location_uri, backend, public=False, read_tenants=[], write_tenants=None, context=None)¶
- glance_store.multi_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
backend – Name of the backend to store the image
- 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.multi_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.multi_backend.verify_store()¶