]>
git.ipfire.org Git - oddments/fireinfo.git/blob - fireinfo/hypervisor.py
83f2a8538fff85d9b97a51a4ef01c0999502980c
6 class Hypervisor(object):
8 self
.__info
= _fireinfo
.get_hypervisor()
13 Return the current instance of the System class.
15 We need to do that as a property because otherwise
18 return system
.System()
23 Returns the name of the hypervisor vendor.
28 # Some of the hypervisors can be detected in a right way.
29 # We can return them at this place.
30 if self
.__info
["hypervisor"] in ("Xen", "VMWare", "KVM"):
31 return self
.__info
["hypervisor"]
33 # Citrix Xen says it is Microsoft Hv.
34 if self
.__info
["hypervisor"] == "Microsoft" and \
35 self
.system
.bios_vendor
== "Xen":
38 if not self
.__info
["hypervisor"]:
39 # On VMWare systems, the bios vendor string contains "VMWare".
40 if self
.__is
_hypervisor
_vmware
():
43 # VirtualBox got "innotek GmbH" as bios vendor.
44 elif self
.__is
_hypervisor
_virtualbox
():
52 Returns if the host is running in full virt mode or
53 if it is running in a paravirtualized environment.
58 return self
.__info
["virtype"]
63 Returns true if the host is running in a virtual environment.
66 return _fireinfo
.is_virtualized() or \
67 "hypervisor" in self
.system
.cpu
.flags
or \
68 self
.__is
_hypervisor
_virtualbox
() or \
69 self
.__is
_hypervisor
_vmware
()
71 def __is_hypervisor_virtualbox(self
):
73 Check for virtualbox hypervisor by comparing the bios vendor string
76 return self
.system
.bios_vendor
== "innotek GmbH"
78 def __is_hypervisor_vmware(self
):
80 Check for the VMWare hypervisor by the VMWare Hypervisor port check.
82 http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458
84 return self
.system
.bios_vendor
.startswith("VMWare-") and \
85 _fireinfo
.vmware_hypervisor_port_check()
88 if __name__
== "__main__":
91 print "Vendor:", h
.vendor
93 print "Virtual:", h
.virtual