1 Add LDOMS facter for SPARC and fix prtdiag output so that it doesn't report |
|
2 --- facter-1.6.18/lib/facter/virtual.rb.orig 2014-02-04 14:06:17.961499519 -0800 |
|
3 +++ facter-1.6.18/lib/facter/virtual.rb 2014-02-04 14:15:22.888059597 -0800 |
|
4 @@ -119,9 +119,9 @@ |
|
5 result = "hyperv" if pd =~ /Product Name: Virtual Machine/ |
|
6 end |
|
7 elsif Facter.value(:kernel) == 'SunOS' |
|
8 - res = Facter::Util::Resolution.new('prtdiag') |
|
9 + res = Facter::Util::Resolution.new('/usr/sbin/prtdiag 2>/dev/null') |
|
10 res.timeout = 6 |
|
11 - res.setcode('prtdiag') |
|
12 + res.setcode('/usr/sbin/prtdiag 2>/dev/null') |
|
13 output = res.value |
|
14 if not output.nil? |
|
15 output.each_line do |pd| |
|
16 @@ -210,3 +210,43 @@ |
|
17 end |
|
18 end |
|
19 end |
|
20 + |
|
21 + |
|
22 +## |
|
23 +# Fact: logical_domain |
|
24 +# |
|
25 +# Purpose: A facter fact to report logical_domain(ldom) status on a system. |
|
26 +# This facter is only available on SPARC |
|
27 +# |
|
28 +# Resolution: Provides the following logical_domain information. |
|
29 +# current: The current environment is ldogical domain. |
|
30 +# supported: The current environment is control domain which can have logical |
|
31 +# domain |
|
32 +# unsupported: Logical domain is not supported on the environment |
|
33 +# |
|
34 + |
|
35 +Facter.add("logical_domain") do |
|
36 + confine :operatingsystem => :Solaris, :hardwareisa => :sparc |
|
37 + setcode do |
|
38 + virtinfo = %x{/sbin/virtinfo list -H -o class logical-domain 2>/dev/null} |
|
39 + virtinfo = virtinfo.split("\n") |
|
40 + virtinfo = virtinfo[0] # Doesn't need to check each logical-domain class |
|
41 + |
|
42 + case virtinfo |
|
43 + when "supported" |
|
44 + virtinfo |
|
45 + when "current" |
|
46 + # Even control domain can have "logical_domain => current" |
|
47 + # To verify, control-role property should be examined. |
|
48 + ctrl_role = %x{virtinfo -c current get -Ho value control-role logical-domain 2> /dev/null} |
|
49 + case ctrl_role.chomp! |
|
50 + when "true" |
|
51 + "supported" |
|
52 + when "false" |
|
53 + virtinfo |
|
54 + end |
|
55 + else |
|
56 + "unsupported" |
|
57 + end |
|
58 + end |
|
59 +end |
|