openstack ERROR zun.common.exception AttributeError: ‘Query’ object has no attribute ‘with_lockmode’

openstack ERROR zun.common.exception AttributeError: ‘Query’ object has no attribute ‘with_lockmode’。


出现错误如下:

2023-07-19 09:51:04.037 10958 ERROR zun.common.exception Traceback (most recent call last):
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/common/exception.py”, line 110, in wrapped
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception return func(*args, **kwargs)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/validation/init.py”, line 55, in wrapper
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception return func(*args, **kwargs)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/api/controllers/v1/containers.py”, line 872, in reboot
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception container.save(context)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/oslo_versionedobjects/base.py”, line 226, in wrapper
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception return fn(self, *args, **kwargs)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/objects/container.py”, line 275, in save
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception updates)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/osprofiler/profiler.py”, line 159, in wrapper
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception result = f(*args, **kwargs)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/api.py”, line 133, in update_container
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception context, container_type, container_id, values)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/sqlalchemy/api.py”, line 253, in update_container
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception return self._do_update_container(container_type, container_id, values)
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception File “/usr/local/lib/python3.6/site-packages/zun/db/sqlalchemy/api.py”, line 262, in _do_update_container
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception ref = query.with_lockmode(‘update’).one()
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception AttributeError: ‘Query’ object has no attribute ‘with_lockmode’
2023-07-19 09:51:04.037 10958 ERROR zun.common.exception


解决方法:

pip3 list | grep -i sql

主要是由于SQLAlchemy版本过高导致的,只需要安装合适的版本即可:

pip3 install SQLAlchemy==1.3.8

如果有其他包依赖这个包,需要解决依赖关系。

重启相关的服务,例如:

systemctl restart zun-api zun-wsproxy

你可能感兴趣的:(日常错误,openstack,python,linux,zun)