今天在一台通过apt-get安装过老版本libvirt(0.9.8)的机器上安装OpenStack,由于老版本的libvirt有Bug,故通过源码编译安装1.2.0版本。编译安装一切正常,不过在启动nova-compute服务时出现错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 346, in fire_timers
timer()
File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/timer.py", line 56, in __call__
cb(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/eventlet/event.py", line 163, in _do_send
waiter.switch(result)
File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 194, in main
result = function(*args, **kwargs)
File "/opt/stack/nova/nova/service.py", line 132, in run_server
server.start()
File "/opt/stack/nova/nova/service.py", line 398, in start
self.manager.init_host()
File "/opt/stack/nova/nova/compute/manager.py", line 294, in init_host
self.driver.init_host(host=self.host)
File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 344, in init_host
if not self.has_min_version(MIN_LIBVIRT_VERSION):
File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 332, in has_min_version
libvirt_version = self._conn.getLibVersion()
File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 361, in _get_connection
self._connect, self.uri, self.read_only)
File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 139, in proxy_call
rv = execute(f,*args,**kwargs)
File "/usr/local/lib/python2.7/dist-packages/eventlet/tpool.py", line 77, in tworker
rv = meth(*args,**kwargs)
File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 415, in _connect
return libvirt.openAuth(uri, auth, 0)
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 102, in openAuth
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory
2014-03-08 09:13:10 CRITICAL nova [-] Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory
/usr/local/sbin/libvirtd -l -f /etc/libvirtd.conf
/usr/local/sbin/libvirtd: initialization failed
#将以下语句添加到 /etc/profile 中
export export LC_ALL=POSIX
#重新加载
source /etc/profile
# /usr/local/sbin/libvirtd -l -f /etc/libvirtd.conf
2014-03-08 00:57:31.361+0000: 10577: info : libvirt version: 1.2.0
2014-03-08 00:57:31.361+0000: 10577: error : virNetTLSContextCheckCertFile:117 : Cannot read CA certificate '/usr/local/etc/pki/CA/cacert.pem': No such file or directory
但发现正常运行的机器上也没有 /usr/local/etc/pki/CA/cacert.pem这个文件,再次检查/etc/libvirtd.conf文件,发现有这么一段:
# Flag listening for secure TLS connections on the public TCP/IP port.
# NB, must pass the --listen flag to the libvirtd process for this to
# have any effect.
#
# It is necessary to setup a CA and issue server certificates before
# using this capability.
#
# This is enabled by default, uncomment this to disable it
# listen_tls = 0
于是将最后一行解除注释,关闭验证,再次启动libvirtd,启动正常,问题得解。
补充,有时候创建不了快照,可能是qemu-common或是qemu-utils没有安装好,apt-get重装也可解决,主要还是从错误信息中找相关线索。
参考资料:
http://www.cnblogs.com/zhangzhang/archive/2013/03/04/2943263.html
http://liuzhijun.iteye.com/blog/1783698