3333N/APatch for FACT-662 Extend ldom.rb to indicate whether ldom creation is supported
3333N/AUpstream bug: https://tickets.puppetlabs.com/browse/FACT-662
3333N/A--- facter-2.1.0/lib/facter/ldom.rb.orig 2014-08-20 10:20:46.279840866 -0600
3333N/A+++ facter-2.1.0/lib/facter/ldom.rb 2014-08-20 10:25:26.560542193 -0600
3333N/A@@ -46,4 +46,37 @@
3333N/A end
3333N/A end
3333N/A end
3333N/A+
3333N/A+
3333N/A+ #
3333N/A+ # Resolution: Provides the following logical_domain information.
3333N/A+ # current: The current environment is logical domain.
3333N/A+ # supported: The current environment is control domain which can have logical
3333N/A+ # domain
3333N/A+ # unsupported: Logical domain is not supported on the environment
3333N/A+ #
3333N/A+ Facter.add("logical_domain") do
3333N/A+ setcode do
3333N/A+ virtinfo = %x{/sbin/virtinfo list -H -o class logical-domain 2>/dev/null}
3333N/A+ virtinfo = virtinfo.split("\n")
3333N/A+ virtinfo = virtinfo[0] # Doesn't need to check each logical-domain class
3333N/A+
3333N/A+ case virtinfo
3333N/A+ when "supported"
3333N/A+ virtinfo
3333N/A+ when "current"
3333N/A+ # Even control domain can have "logical_domain => current"
3333N/A+ # To verify, control-role property should be examined.
3333N/A+ ctrl_role = %x{virtinfo -c current get -Ho value control-role logical-domain 2> /dev/null}
3333N/A+ case ctrl_role.chomp!
3333N/A+ when "true"
3333N/A+ "supported"
3333N/A+ when "false"
3333N/A+ virtinfo
3333N/A+ end
3333N/A+ else
3333N/A+ "unsupported"
3333N/A+ end
3333N/A+ end
3333N/A+ end
3333N/A end