openstack配置xen
首先安装nova-compute-xen:apt-get install nova-compute-xen
配置nova:
/etc/nova/nova-compute.conf:
--libvirt_type=xen
/etc/nova/nova.conf:
--connection_type=libvirt
--libvirt_type=xen
这样还是无法启动nova-compute,报错:
2012-06-28 15:12:26 TRACE nova Traceback (most recent call last):
2012-06-28 15:12:26 TRACE nova File "/usr/bin/nova-compute", line 49, in <module>
2012-06-28 15:12:26 TRACE nova service.wait()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 166, in wait
2012-06-28 15:12:26 TRACE nova return self._exit_event.wait()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
2012-06-28 15:12:26 TRACE nova return hubs.get_hub().switch()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 177, in switch
2012-06-28 15:12:26 TRACE nova return self.greenlet.switch()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 192, in main
2012-06-28 15:12:26 TRACE nova result = function(*args, **kwargs)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/service.py", line 101, in run_server
2012-06-28 15:12:26 TRACE nova server.start()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/service.py", line 174, in start
2012-06-28 15:12:26 TRACE nova self.manager.update_available_resource(ctxt)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2409, in update_ava
ilable_resource
2012-06-28 15:12:26 TRACE nova self.driver.update_available_resource(context, self.host)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/connection.py", line 1934, in up
date_available_resource
2012-06-28 15:12:26 TRACE nova 'memory_mb': self.get_memory_mb_total(),
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/connection.py", line 1711, in ge
t_memory_mb_total
2012-06-28 15:12:26 TRACE nova meminfo = self._conn.getInfo()[1]
2012-06-28 15:12:26 TRACE nova NameError: global name 'self' is not defined
2012-06-28 15:12:26 TRACE nova File "/usr/bin/nova-compute", line 49, in <module>
2012-06-28 15:12:26 TRACE nova service.wait()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 166, in wait
2012-06-28 15:12:26 TRACE nova return self._exit_event.wait()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
2012-06-28 15:12:26 TRACE nova return hubs.get_hub().switch()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 177, in switch
2012-06-28 15:12:26 TRACE nova return self.greenlet.switch()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 192, in main
2012-06-28 15:12:26 TRACE nova result = function(*args, **kwargs)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/service.py", line 101, in run_server
2012-06-28 15:12:26 TRACE nova server.start()
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/service.py", line 174, in start
2012-06-28 15:12:26 TRACE nova self.manager.update_available_resource(ctxt)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 2409, in update_ava
ilable_resource
2012-06-28 15:12:26 TRACE nova self.driver.update_available_resource(context, self.host)
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/connection.py", line 1934, in up
date_available_resource
2012-06-28 15:12:26 TRACE nova 'memory_mb': self.get_memory_mb_total(),
2012-06-28 15:12:26 TRACE nova File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/connection.py", line 1711, in ge
t_memory_mb_total
2012-06-28 15:12:26 TRACE nova meminfo = self._conn.getInfo()[1]
2012-06-28 15:12:26 TRACE nova NameError: global name 'self' is not defined
看起来是Ubuntu12.04上的nova有点bug,作如下修改:
/usr/lib/python2.7/dist-packages/nova/virt/libvirt/connection.py:1699行开始的两行改为:
#@staticmethod
def get_memory_mb_total(self):
def get_memory_mb_total(self):
这样就可以启动nova-compute了。
另外,如果要用virsh来看虚机,要注意virsh默认为qemu,需要加上xen的参数:virsh -c xen:///