Spec Lite: 为每个存储添加 location url 前缀属性¶
- 项目:
glance_store
- 问题:
在多存储实现中,glance 已向 location 对象添加了新的元数据 ‘store’,以便于识别上传特定图像的存储。当操作员升级 glance 节点以使用多个存储时,现有的图像并不包含与之关联的存储信息。因此,如果用户想要下载任何此类特定图像,由于它没有关联 ‘store’,则会在所有配置的存储中搜索该图像。这可能会导致性能开销。
- 解决方案:
为了克服这个问题,我们建议为每个存储对象添加新的属性 ‘_url_prefix’。当 glance-api 服务启动时,它会在内存中存储一个全局映射,其中包含每个存储的存储对象、scheme 和 location_class。
存储在内存中的 location 映射示例
{ 'file_2': { 'store': <glance_store._drivers.filesystem.Store object>, 'store_entry': 'file', 'location_class': <class 'glance_store._drivers.filesystem.StoreLocation'> }, 'file_1': { 'store': <glance_store._drivers.filesystem.Store>, 'store_entry': 'file', 'location_class': <class 'glance_store._drivers.filesystem.StoreLocation'> } }在初始化每个存储时,将使用每个存储的配置检索 location url,并将其分配给每个存储对象的 ‘_url_prefix’ 属性。每当对图像进行任何 GET 调用(在升级到多存储之前)时,该图像的 location url 将与 ‘_url_prefix’ 匹配,并且等效的存储信息将被更新到该图像的 location 元数据中。
- 替代方案:
无,继续使用当前机制。
影响: DocImpact
- 时间线:
包含在 Train 版本中。
- 链接:
无
- 负责人:
abhishekk