欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

解决 ERROR oslo_service.periodic_task AttributeError: ‘ComputeNode‘ object has no attribute ‘nodename‘

程序员文章站 2022-06-01 09:27:04
...

openstack管理和创建容器,出现如下类似的错误:

2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task During handling of the above exception, another exception occurred:
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task Traceback (most recent call last):
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/oslo_service/periodic_task.py”, line 216, in run_periodic_tasks
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task task(self, context)
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/manager.py”, line 1109, in inventory_host
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task rt.update_available_resources(context)
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 76, in update_available_resources
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task node.rp_uuid = self._get_node_rp_uuid(context, node)
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 111, in _get_node_rp_uuid
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task raise exception.ComputeHostNotFound(host=node.nodename)
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task AttributeError: ‘ComputeNode’ object has no attribute ‘nodename’
2021-06-04 02:25:28.557 22410 ERROR oslo_service.periodic_task
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task [req-6da6d514-a05c-4a3b-ad59-8fe953346c30 - - - - -] Error during Manager.inventory_host: AttributeError: ‘ComputeNode’ object has no attribute ‘nodename’
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task Traceback (most recent call last):
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 109, in _get_node_rp_uuid
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task context, node.hostname)[‘uuid’]
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/scheduler/client/report.py”, line 2136, in get_provider_by_name
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task raise exception.ResourceProviderNotFound(name_or_uuid=name)
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task zun.common.exception.ResourceProviderNotFound: No such resource provider localhost.localdomain.
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task During handling of the above exception, another exception occurred:
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task Traceback (most recent call last):
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/oslo_service/periodic_task.py”, line 216, in run_periodic_tasks
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task task(self, context)
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/manager.py”, line 1109, in inventory_host
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task rt.update_available_resources(context)
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 76, in update_available_resources
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task node.rp_uuid = self._get_node_rp_uuid(context, node)
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 111, in _get_node_rp_uuid
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task raise exception.ComputeHostNotFound(host=node.nodename)
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task AttributeError: ‘ComputeNode’ object has no attribute ‘nodename’
2021-06-04 02:26:28.555 22410 ERROR oslo_service.periodic_task


查看相关服务的状态:

systemctl status zun-compute
systemctl status kuryr-libnetwork

发现状态异常:

● kuryr-libnetwork.service - Kuryr-libnetwork - Docker network plugin for Neutron
   Loaded: loaded (/etc/systemd/system/kuryr-libnetwork.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 五 2021-06-04 03:48:32 EDT; 940ms ago
  Process: 13311 ExecStart=/usr/local/bin/kuryr-server --config-file /etc/kuryr/kuryr.conf (code=exited, status=1/FAILURE)
 Main PID: 13311 (code=exited, status=1/FAILURE)

6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: File "/usr/lib64/python3.6/logging/handlers.py", line 437, in __init__
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: File "/usr/lib64/python3.6/logging/__init__.py", line 1032, in __init__
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: StreamHandler.__init__(self, self._open())
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: File "/usr/lib64/python3.6/logging/__init__.py", line 1061, in _open
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: return open(self.baseFilename, self.mode, encoding=self.encoding)
6月 04 03:48:32 localhost.localdomain kuryr-server[13311]: PermissionError: [Errno 13] Permission denied: '/var/log/kuryr/kuryr-server.log'
6月 04 03:48:32 localhost.localdomain systemd[1]: kuryr-libnetwork.service: main process exited, code=exited, status=1/FAILURE
6月 04 03:48:32 localhost.localdomain systemd[1]: Unit kuryr-libnetwork.service entered failed state.
6月 04 03:48:32 localhost.localdomain systemd[1]: kuryr-libnetwork.service failed.

查看配置文件:

vim /etc/kuryr/kuryr.conf 

检查配置文件中对应的日志文件路径是否存在,并赋予正确的权限:

chown kuryr:kuryr /var/log/kuryr/kuryr-server.log
# 或者
chmod 777 /var/log/kuryr/kuryr-server.log

重新启动服务,并进行测试:

systemctl start kuryr-libnetwork
zun run --name test cirros
zun list
+--------------------------------------+------+--------+---------+------------+---------------+-------+
| uuid                                 | name | image  | status  | task_state | addresses     | ports |
+--------------------------------------+------+--------+---------+------------+---------------+-------+
| d1a2d3d2-e8df-4315-9e74-4858820f817a | test | cirros | Running | None       | 172.114.0.249 | []    |
+--------------------------------------+------+--------+---------+------------+---------------+-------+

服务正常了。


笔语:

编程没有那么难,遇到错误,首先静下心来看日志,看具体错误,弄清楚问题所在,很容易解决问题;盲目的百度搜素错误关键词,会浪费很多无效的时间~