Sha256: 4df5cffbcdb74b46adaba63001faab6963c63452bd08c8b12b6648c5636024dd
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module Facts module Linux module Hypervisors class Xen FACT_NAME = 'hypervisors.xen' def initialize @log = Facter::Log.new(self) @virtual = Facter::Util::Facts::VirtualDetector.new end def call_the_resolver if xen? @log.debug('Xen hypervisor detected') fact_value = {} fact_value[:context] = hvm? ? 'hvm' : 'pv' fact_value[:privileged] = Facter::Resolvers::Xen.resolve(:privileged) return Facter::ResolvedFact.new(FACT_NAME, fact_value) end @log.debug('No Xen hypervisor detected.') [] end private def xen? @virtual.platform =~ /xen/ end def hvm? discover_hypervisor == 'xenhvm' || Facter::Resolvers::Lspci.resolve(:vm) == 'xenhvm' end def discover_hypervisor product_name = Facter::Resolvers::Linux::DmiBios.resolve(:product_name) return unless product_name Facter::Util::Facts::HYPERVISORS_HASH.each { |key, value| return value if product_name.include?(key) } product_name end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facter-4.1.1 | lib/facter/facts/linux/hypervisors/xen.rb |
facter-4.1.0 | lib/facter/facts/linux/hypervisors/xen.rb |