编辑计算节点文件:/usr/lib/python2.6/site-packages/nova-2012.2.4-py2.6.egg/nova/virt/libvirt/driver.py
在import的地方加入:
import datetime
将get_available_resource函数修改为如下:
def get_available_resource(self):
"""Retrieve resource info.
This method is called as a periodic task and is used only
in live migration currently.
:returns: dictionary containing resource info
"""
dic = {
'updated_at': datetime.datetime.utcnow(),
'vcpus': self.get_vcpu_total(),
'memory_mb': self.get_memory_mb_total(),
'local_gb': self.get_local_gb_total(),
'local_gb_local': self.get_local_gb_total_local(),
'vcpus_used': self.get_vcpu_used(),
'memory_mb_used': self.get_memory_mb_used(),
'local_gb_used': self.get_local_gb_used(),
'local_gb_used_local': self.get_local_gb_used(),
'hypervisor_type': self.get_hypervisor_type(),
'hypervisor_version': self.get_hypervisor_version(),
'hypervisor_hostname': self.get_hypervisor_hostname(),
'cpu_info': self.get_cpu_info(),
'disk_available_least': self.get_disk_available_least(),
'disk_available_least_local': self.get_disk_available_least_local()}
return dic