nova-compute strart 上的错误 - libvirt:无法将套接字连接到“/var/run/libvirt/libvirt-sock”:没有此文件或目录

nova-compute strart 上的错误 - libvirt:无法将套接字连接到“/var/run/libvirt/libvirt-sock”:没有此文件或目录

启动 nova 计算服务的任何尝试都会失败并出现错误HypervisorUnavailable: Connection to the hypervisor is broken on host:

跟踪日志如下(取自/var/log/nova/nova-compute.log

AUDIT nova.service [-] Starting compute node (version 2014.1.1)
ERROR nova.virt.libvirt.driver [-] Connection to libvirt failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
TRACE nova.virt.libvirt.driver Traceback (most recent call last):
TRACE nova.virt.libvirt.driver   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 787, in _connect
TRACE nova.virt.libvirt.driver     libvirt.openAuth, uri, auth, flags)
TRACE nova.virt.libvirt.driver   File "/usr/lib/python2.7/dist-packages/eventlet/tpool.py", line 139, in proxy_call
TRACE nova.virt.libvirt.driver     rv = execute(f,*args,**kwargs)
TRACE nova.virt.libvirt.driver   File "/usr/lib/python2.7/dist-packages/eventlet/tpool.py", line 77, in tworker
TRACE nova.virt.libvirt.driver     rv = meth(*args,**kwargs)
TRACE nova.virt.libvirt.driver   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 105, in openAuth
TRACE nova.virt.libvirt.driver     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
TRACE nova.virt.libvirt.driver libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
TRACE nova.virt.libvirt.driver
ERROR nova.openstack.common.threadgroup [-] Connection to the hypervisor is broken on host: <HOST_NAME>
TRACE nova.openstack.common.threadgroup Traceback (most recent call last):
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/threadgroup.py", line 117, in wait
TRACE nova.openstack.common.threadgroup     x.wait()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/threadgroup.py", line 49, in wait
TRACE nova.openstack.common.threadgroup     return self.thread.wait()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 168, in wait
TRACE nova.openstack.common.threadgroup     return self._exit_event.wait()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
TRACE nova.openstack.common.threadgroup     return hubs.get_hub().switch()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 187, in switch
TRACE nova.openstack.common.threadgroup     return self.greenlet.switch()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
TRACE nova.openstack.common.threadgroup     result = function(*args, **kwargs)
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/service.py", line 483, in run_service
TRACE nova.openstack.common.threadgroup     service.start()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 163, in start
TRACE nova.openstack.common.threadgroup     self.manager.init_host()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 1006, in init_host
TRACE nova.openstack.common.threadgroup     self.driver.init_host(host=self.host)
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 656, in init_host
TRACE nova.openstack.common.threadgroup     self._do_quality_warnings()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 639, in _do_quality_warnings
 TRACE nova.openstack.common.threadgroup     caps = self.get_host_capabilities()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 2849, in get_host_capabilities
TRACE nova.openstack.common.threadgroup     xmlstr = self._conn.getCapabilities()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 721, in _get_connection
TRACE nova.openstack.common.threadgroup     wrapped_conn = self._get_new_connection()
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 674, in _get_new_connection
TRACE nova.openstack.common.threadgroup     wrapped_conn = self._connect(self.uri(), self.read_only)
TRACE nova.openstack.common.threadgroup   File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 796, in _connect
TRACE nova.openstack.common.threadgroup     raise exception.HypervisorUnavailable(host=CONF.host)
TRACE nova.openstack.common.threadgroup HypervisorUnavailable: Connection to the hypervisor is broken on host: <HOST_NAME>

没有其他日志文件表明任何错误 syslogdmesg并且 /var/log/libvirt/libvirtd.log没有显示任何问题

libvirt 配置 ( /etc/libvirt/libvirtd.conf) 被设置为记录错误 log_outputs="3:syslog:libvirtd"

在错误出现之前,节点运行顺利,没有做出任何改变。

答案1

就我而言,我重新安装了 libvirt 和相关软件包,而无需重新启动libvirtd。因此,使用以下三个命令解决了错误:

systemctl stop libvirtd
systemctl start libvirtd
systemctl status libvirtd

答案2

似乎是 的配置错误libvirt。简而言之,问题在于libvirtd未以标志开头--listen,因此它未创建 nova 服务正在搜索的适当 sock 文件。

查看我的相关内容回答在 ubuntu 上询问如何在“监听”模式下配置 libvirt。

答案3

昨晚我尝试重启nova-compute服务时也遇到了类似的情况。在您提供的 lpg 中,我们可以看到以下行

无法将套接字连接到‘/var/run/libvirt/libvirt-sock’:没有这样的文件或目录 TRACE nova.virt.libvirt.driver”

因此我们可以知道该问题是由于libvirtd服务无法正常运行造成的。

就我而言,我检查了服务状态libvirtd以找出失败的原因,然后尝试重新启动它,如下所示

在此处输入图片描述

我对上面的问题 (g-io-error-quark,1) 进行了大量的 Google 搜索。但所有结果都是关于 /etc/fstab 的问题。

就我而言,我尝试使用该libvirtd -l命令来获取一些提示

在此处输入图片描述

终于找到了!问题出在/var/run与路径 /run 的链接上,链接失败。所以我重置了与 /run 的链接,然后libvirtd成功重启了服务。

我希望这对你有用。

相关内容