diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-10-07 11:29:10 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-10-21 10:20:33 +1100 |
commit | 6393e82e86def14891b204803aba156059736749 (patch) | |
tree | 8e6e8d75e26243b645bfd9639456a27d8eb11e21 | |
parent | 37b14d219f89fdef8aea4a7bddb13eeb736b0dc7 (diff) | |
download | facter-6393e82e86def14891b204803aba156059736749.tar.gz facter-6393e82e86def14891b204803aba156059736749.tar.xz facter-6393e82e86def14891b204803aba156059736749.zip |
Fixed #1634 - Update virtual fact to differentiate OpenVZ hardware nodes and virtual environments
-rw-r--r-- | CHANGELOG | 6 | ||||
-rw-r--r-- | lib/facter/virtual.rb | 10 |
2 files changed, 14 insertions, 2 deletions
@@ -1,9 +1,13 @@ 1.5.x: Fixed #1619 - Applying patch by seanmil, adding support for SLES. + + Fixed #1634 - Update virtual fact to differentiate OpenVZ + hardware nodes and virtual environments Fixed #1509 - Fixed version recognition for SLES. - Fixes #1582 - Fix MAC address reporting for Linux bonding slave interfaces + Fixes #1582 - Fix MAC address reporting for Linux bonding + slave interfaces Fixed #1575 - CentOS fix for Facter SPEC file diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb index 4404ae9..fd05d43 100644 --- a/lib/facter/virtual.rb +++ b/lib/facter/virtual.rb @@ -8,7 +8,15 @@ Facter.add("virtual") do setcode do if FileTest.exists?("/proc/user_beancounters") - result = "openvz" + # openvz. can be hardware node or virtual environment + # read the init process' status file, it has laxer permissions + # than /proc/user_beancounters (so this won't fail as non-root) + txt = File.read("/proc/1/status") + if txt =~ /^envID:[[:blank:]]+0$/mi + result = "openvzhn" + else + result = "openvzve" + end end if FileTest.exists?("/proc/xen/capabilities") && FileTest.readable?("/proc/xen/capabilities") |