]>
git.ipfire.org Git - oddments/fireinfo.git/blob - fireinfo/hypervisor.py
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 "VMWare" in self
.system
.bios_vendor
:
43 # VirtualBox got "innotek GmbH" as bios vendor.
44 elif self
.system
.bios_vendor
== "innotek GmbH":
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
.system
.bios_vendor
== "innotek GmbH"
71 if __name__
== "__main__":
74 print "Vendor:", h
.vendor
76 print "Virtual:", h
.virtual