Emilien Macchi ca72456409 Check if VTX is enabled on hypervisor nodes
VTX is required when using KVM as hypervisor on compute nodes.

When the fact will be merged upstream, the lib/facter/vtx.rb file will be
dropped to use the one from facter-core.

Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
2014-09-11 15:43:37 -04:00

28 lines
490 B
Ruby

# Fact: vtx
#
# Purpose:
# Determine whether VT-X is enabled on the node.
#
# Resolution:
# Checks for vmx (intel) or svm (amd) is part of /proc/cpuinfo flags
#
# Caveats:
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
Facter.add('vtx') do
confine :kernel => :linux
setcode do
result = false
begin
# test on Intel and AMD plateforms
if File.read('/proc/cpuinfo') =~ /(vmx|svm)/
result = true
end
rescue
end
result
end
end