glance_store.driver 模块¶
所有存储后端的基类
- class glance_store.driver.BackendGroupConfiguration(store_opts, config_group=None, conf=None)¶
基类:
object- append_config_values(store_opts)¶
- get(key, default=None)¶
- set_default(opt_name, default)¶
- 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_add()¶
这与 configure 类似,只是它专门用于配置存储以接受对象。
如果存储未能成功配置自身,则应引发 exceptions.BadStoreConfiguration。
- delete(*args, **kwargs)¶
- get(*args, **kwargs)¶
- get_schemes()¶
返回此存储可以处理的方案(scheme)的元组。
- get_size(location, context=None)¶
接受一个 glance_store.location.Location 对象,该对象指示图像文件的位置,并返回大小。
- 参数:
location – glance_store.location.Location 对象,来自 glance_store.location.get_location_from_uri()
- 引发:
glance_store.exceptions.NotFound 如果图像不存在。
- get_store_location_class()¶
返回此存储使用的存储位置类。
- set_acls(location, public=False, read_tenants=None, write_tenants=None, context=None)¶
在后端存储中设置图像的读写访问控制列表。
- 参数:
location – glance_store.location.Location 对象,来自 glance_store.location.get_location_from_uri()
public – 一个布尔值,指示图像是否应为公共。
read_tenants – 一个租户字符串列表,应授予对图像的读取访问权限。
write_tenants – 一个租户字符串列表,应授予对图像的写入访问权限。
- property url_prefix¶
- property weight¶
- glance_store.driver.back_compat_add(store_add_fun)¶
为 0.26.0+ 的 Store.add() 函数提供向后兼容。在 0.26.0 版本中,引入了 'hashing_algo' 参数,并且 Store.add() 返回一个包含计算出的 'multihash' 值的 5 元组。
此包装器执行以下操作:
如果未作为参数提供哈希算法标识符,则响应为 0.26.0 之前的 4 元组:
(backend_url, bytes_written, checksum, metadata_dict)
如果提供了哈希算法,则响应为 5 元组:
(backend_url, bytes_written, checksum, multihash, metadata_dict)
包装器通过检查命名参数和位置参数来检测 'hashing_algo' 参数的存在。