From: Michael Tremer Date: Tue, 23 Nov 2010 21:35:36 +0000 (+0100) Subject: Add a flag to say if a host is running in a virtual environment. X-Git-Tag: v0.2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8614fc365b27d8ed1f30927c653f01d060b97eb;p=oddments%2Ffireinfo.git Add a flag to say if a host is running in a virtual environment. --- diff --git a/fireinfo/system.py b/fireinfo/system.py index 74028a6..35a4a33 100644 --- a/fireinfo/system.py +++ b/fireinfo/system.py @@ -5,6 +5,7 @@ import json import os import string +import _fireinfo import cpu import device @@ -28,7 +29,8 @@ class System(object): "kernel" : self.kernel, "root_size" : self.root_size, "devices" : [], - + + "virtual" : self.virtual, } for device in self.devices: @@ -137,8 +139,13 @@ class System(object): dirlist = os.listdir(path) for dir in dirlist: self.devices.append(cls(os.path.join(path, dir))) - - + + @property + def virtual(self): + """ + Say if the host is running in a virtual environment. + """ + return _fireinfo.is_virtualized()