]> git.ipfire.org Git - oddments/fireinfo.git/commitdiff
Xen (paravirtualized) hosts do not set the virtualiztion bit.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 26 Nov 2010 19:38:42 +0000 (20:38 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 26 Nov 2010 19:38:42 +0000 (20:38 +0100)
However, some (or all) hypervisors set the "hypervisor" flags
so we could rely on that if the first check fails.

Thanks to Robert Möker for pointing that out.

fireinfo/hypervisor.py

index 97eb985f55a26c881b2ca0b053afc9fc04208fab..328fd26927799da505771514fb5342fdcf28a8ff 100644 (file)
@@ -57,7 +57,8 @@ class Hypervisor(object):
                        Returns true if the host is running in a virtual environment.
                        Otherwise: false.
                """
-               return _fireinfo.is_virtualized()
+               return _fireinfo.is_virtualized() or \
+                       "hypervisor" in self.system.cpu.flags
 
 
 if __name__ == "__main__":