Newer
Older
from ccnode.hypervisor.lib import vir_tag
# hypervisor related tags
def htype():
"""Hypervisor type."""
# FIXME for other support
return u'kvm'
"""Hypervisor name."""
# What is the point of this tag ? if the information not already in a and id
# ?
def hvm():
"""Hardware virtualization enable."""
# see
# http://www.linux-kvm.org/page/FAQ#How_can_I_tell_if_I_have_Intel_VT_or_AMD-V.3F
# or
# http://www.cyberciti.biz/faq/linux-xen-vmware-kvm-intel-vt-amd-v-support/
# if we are in a xen hypervisor we won't see vt in /proc/cpuinfo
result = {True: u'yes', False: u'no'}
if htype() == u'kvm':
# findout in /proc/cpuinfo if all CPUs have virtualisation enabled
return result[and_(
set(
'vmx', # Intel VT
'svm', # AMD
) & set(
l.split(': ')[-1].split()
) for l in open('/proc/cpuinfo').readline() if l.startswith('Tags')
)]
return None
return handl.hypervisor.vir_con.getVersion()
"""Version of running libvirt."""
return handl.hypervisor.vir_con.getLibVersion()
# jobs
def rjobs():
"""Number of currently running jobs."""
# storage pools
return u' '.join(handl.hypervisor.storage.storages.iterkeys())
"""Number of VMS in the current hypervisor."""