Could not find s3_store_host in configuration options

本文详细解析了OpenStack中Glance API配置问题,特别是如何通过调整known_stores配置项来控制图片存储后端的选择,避免不必要的错误提示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

glance模块的配置文件glance-api.conf已将default_store设置为file,并且将swift、rbd、s3相关的配置选项全部注释掉了,但启动glance-api的时候控制台依然输出以上错误信息,虽然不影响使用,但看着终归不爽。

追踪代码后发现,glance的wsgi controller(位于glance/glance/api/v1/images.py)中包含了一个名为create_stores()的初始化函数,改函数的实现位于:glance/glance/store/__init__.py中,相关代码如下:

def create_stores():
    """
    Registers all store modules and all schemes
    from the given config. Duplicates are not re-registered.
    """
    store_count = 0
    store_classes = set()
    for store_entry in CONF.known_stores:
        store_entry = store_entry.strip()
        if not store_entry:
            continue
        store_cls = _get_store_class(store_entry)
        store_instance = store_cls()
        schemes = store_instance.get_schemes()
        ... ...

其中known_stores的默认值为:

    cfg.ListOpt('known_stores',
                default=['glance.store.filesystem.Store',
                         'glance.store.http.Store',
                         'glance.store.rbd.Store',
                         'glance.store.s3.Store',
                         'glance.store.swift.Store',
                        ]),

从中可以看到,通过遍历变量known_stores来依次初始化并加载各个后端。

解决方法很简单了,在glance-api.conf文件中添加如下的配置选项:

known_stores=glance.store.filesystem.Store

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值