解决主机服务出现 Error during Manager.inventory_host: FileNotFoundError: [Errno 2] No such file or directory: ‘lspci’ 问题。
出现错误类似如下:
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task [req-a60968c9-1baf-4ca3-893d-2f4d789070e1 - - - - -] Error during Manager.inventory_host: FileNotFoundError: [Errno 2] No such file or directory: ‘lspci’: ‘lspci’
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task Traceback (most recent call last):
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/oslo_service/periodic_task.py”, line 216, in run_periodic_tasks
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task task(self, context)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/manager.py”, line 1109, in inventory_host
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task rt.update_available_resources(context)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 77, in update_available_resources
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task self._setup_pci_tracker(context, node)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/compute/compute_node_tracker.py”, line 53, in _setup_pci_tracker
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task dev_json = self.container_driver.get_pci_resources()
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/container/driver.py”, line 176, in get_pci_resources
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task return os_capability_linux.LinuxHost().get_pci_resources()
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/container/os_capability/host_capability.py”, line 85, in get_pci_resources
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task output, status = utils.execute(‘lspci’, ‘-D’, ‘-nnmm’)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/common/utils.py”, line 365, in execute
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task return custom_execute(*cmd, **kwargs)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/zun/common/utils.py”, line 336, in custom_execute
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task return processutils.execute(*cmd, **kwargs)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/oslo_concurrency/processutils.py”, line 403, in execute
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task env=env_variables)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/local/lib/python3.6/site-packages/eventlet/green/subprocess.py”, line 58, in init
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task subprocess_orig.Popen.init(self, args, 0, *argss, **kwds)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/lib64/python3.6/subprocess.py”, line 729, in init
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task restore_signals, start_new_session)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task File “/usr/lib64/python3.6/subprocess.py”, line 1364, in _execute_child
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task raise child_exception_type(errno_num, err_msg, err_filename)
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task FileNotFoundError: [Errno 2] No such file or directory: ‘lspci’: ‘lspci’
2023-04-12 18:05:32.859 29281 ERROR oslo_service.periodic_task
解决办法:
主要是由于缺少包导致的,安装就可以,例如以CentOS为例:
yum -y install pciutils-3.5.1-3.el7.x86_64
不知道这个报名,可以在安装过这个包的机器上查看包:
rpm -qf `which lspci`