ubuntu22.04LTS安装keystone AttributeError: ‘NoneType‘ object has no attribute ‘getcurrent‘

报错内容

root@controller:~# su -s /bin/sh -c "keystone-manage db_sync" keystone
Exception ignored in: <function _removeHandlerRef at 0x7bc261a4c3a0>
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 846, in _removeHandlerRef
  File "/usr/lib/python3.10/logging/__init__.py", line 226, in _acquireLock
  File "/usr/lib/python3.10/threading.py", line 164, in acquire
  File "/usr/lib/python3/dist-packages/eventlet/green/thread.py", line 34, in get_ident
AttributeError: 'NoneType' object has no attribute 'getcurrent'

解决方法

  1. 打开文件:
    vi /usr/lib/python3/dist-packages/eventlet/green/thread.py
    # or your path to thread.py from exception traceback
    
  2. 修改:
    def get_ident(gr=None):
        if gr is None:
            return id(greenlet.getcurrent())
        else:
            return id(gr)
    
    and make try-except contruction for get id like this:
    
    # 修改这个函数
    def get_ident(gr=None):
        try:
            if gr is None:
                return id(greenlet.getcurrent())
            else:
                return id(gr)
        except:
            return id(gr)
    
  3. 重试
    su -s /bin/bash keystone -c "keystone-manage db_sync"
    

参考

https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg6040774.html

https://github.com/eventlet/eventlet/issues/953

  • 8
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Ubuntu 22.04 LTS安装Keystone,可以按照以下步骤操作: 1. 打开终端,并以root用户身份登录。 2. 使用以下命令更新Ubuntu软件包: ```bash apt-get update apt-get upgrade ``` 3. 安装Keystone软件包: ```bash apt-get install keystone ``` 4. 配置Keystone: - 打开Keystone配置文件: ```bash nano /etc/keystone/keystone.conf ``` - 在`[DEFAULT]`部分中,设置`admin_token`和`verbose`选项: ```conf [DEFAULT] admin_token = <ADMIN_TOKEN> verbose = True ``` 其中,`<ADMIN_TOKEN>`是一个随机字符串,用于验证Keystone API请求。可以使用以下命令生成一个随机字符串: ```bash openssl rand -hex 10 ``` - 在`[database]`部分中,设置数据库连接信息: ```conf [database] connection = mysql+pymysql://keystone:<DB_PASSWORD>@localhost/keystone ``` 其中,`<DB_PASSWORD>`是数据库密码。 5. 初始化Keystone数据库: ```bash su -s /bin/sh -c "keystone-manage db_sync" keystone ``` 6. 启动Keystone服务: ```bash systemctl start keystone ``` 7. 验证Keystone服务是否正常运行: - 获取管理员令牌: ```bash export OS_TOKEN=<ADMIN_TOKEN> ``` 其中,`<ADMIN_TOKEN>`是在步骤4中设置的管理员令牌。 - 获取Keystone服务的API端点: ```bash export OS_URL=http://localhost:5000/v3 ``` - 获取Keystone服务的API版本: ```bash export OS_IDENTITY_API_VERSION=3 ``` - 验证Keystone服务是否正常运行: ```bash openstack token issue ``` 如果Keystone服务正常运行,则应该返回一个新的身份令牌。 以上就是在Ubuntu 22.04 LTS安装Keystone的步骤。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值