diff options
Diffstat (limited to 'lib/facter/util/virtual.rb')
-rw-r--r-- | lib/facter/util/virtual.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb index 8db57a3..0c3fb73 100644 --- a/lib/facter/util/virtual.rb +++ b/lib/facter/util/virtual.rb @@ -24,4 +24,20 @@ module Facter::Util::Virtual return true if txt =~ /^(s_context|VxID):[[:blank:]]*[1-9]/ return false end + + def self.vserver_type + if self.vserver? + if FileTest.exists?("/proc/virtual") + "vserver_host" + else + "vserver" + end + end + end + + def self.xen? + ["/proc/sys/xen", "/sys/bus/xen", "/proc/xen" ].detect do |f| + FileTest.exists?(f) + end + end end |