From: Michael Tremer Date: Fri, 26 Nov 2010 19:38:42 +0000 (+0100) Subject: Xen (paravirtualized) hosts do not set the virtualiztion bit. X-Git-Tag: v0.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f54ce566cb74672914ac2294827927eda4f9ceda;p=oddments%2Ffireinfo.git Xen (paravirtualized) hosts do not set the virtualiztion bit. 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. --- diff --git a/fireinfo/hypervisor.py b/fireinfo/hypervisor.py index 97eb985..328fd26 100644 --- a/fireinfo/hypervisor.py +++ b/fireinfo/hypervisor.py @@ -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__":