From 43e203c688399ac86d337514aecb6fa0c9def683 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Wed, 3 Nov 2010 21:55:58 +0100 Subject: (#5040) fact virtual should detect hpvm With HP-UX you can build virtual machines that are often refered to as HP-VMs. This patch detecs HP-VMs by introducing a new function hpvm? that will check the output of /usr/bin/getconf MACHINE_MODEL. This should not depend on any tools that might be not installed. If inside a HP-VM the command will say something like ia64 hp server Integrity Virtual Machine while on real hardware the output could be ia64 hp server rx660 so searching for "Virtual Machine" should work. Currently it only works if the guest is also running HP-UX. (I guess this is the most common usecase). --- lib/facter/virtual.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/facter/virtual.rb') diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb index c14a715..faefb29 100644 --- a/lib/facter/virtual.rb +++ b/lib/facter/virtual.rb @@ -1,7 +1,7 @@ require 'facter/util/virtual' Facter.add("virtual") do - confine :kernel => %w{Linux FreeBSD OpenBSD SunOS} + confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX} result = "physical" @@ -9,6 +9,10 @@ Facter.add("virtual") do result = "zone" if Facter::Util::Virtual.zone? + if Facter.value(:kernel)=="HP-UX" + result = "hpvm" if Facter::Util::Virtual.hpvm? + end + if Facter::Util::Virtual.openvz? result = Facter::Util::Virtual.openvz_type() end @@ -76,11 +80,11 @@ Facter.add("virtual") do end Facter.add("is_virtual") do - confine :kernel => %w{Linux FreeBSD OpenBSD SunOS} + confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX} setcode do case Facter.value(:virtual) - when "xenu", "openvzve", "vmware", "kvm", "vserver", "jail" + when "xenu", "openvzve", "vmware", "kvm", "vserver", "jail", "zone", "hpvm" true else false -- cgit