3136N/APatch for FACT-662 Extend ldom.rb to indicate whether ldom creation is supported
3136N/AUpstream bug: https://tickets.puppetlabs.com/browse/FACT-662
5858N/A
5858N/A--- facter-2.4.6/lib/facter/ldom.rb.orig 2016-04-19 15:19:02.953948198 -0700
5858N/A+++ facter-2.4.6/lib/facter/ldom.rb 2016-04-19 15:24:33.197245752 -0700
5858N/A@@ -1,3 +1,7 @@
5858N/A+#######################################################################
5858N/A+# Oracle has modified the originally distributed contents of this file.
5858N/A+#######################################################################
5858N/A+
5858N/A # Fact: ldom
5858N/A #
5858N/A # Purpose:
5858N/A@@ -48,4 +52,37 @@
3136N/A end
3136N/A end
3136N/A end
3136N/A+
3136N/A+
3136N/A+ #
3136N/A+ # Resolution: Provides the following logical_domain information.
3136N/A+ # current: The current environment is logical domain.
3136N/A+ # supported: The current environment is control domain which can have logical
3136N/A+ # domain
3136N/A+ # unsupported: Logical domain is not supported on the environment
3136N/A+ #
3136N/A+ Facter.add("logical_domain") do
3136N/A+ setcode do
3136N/A+ virtinfo = %x{/sbin/virtinfo list -H -o class logical-domain 2>/dev/null}
3136N/A+ virtinfo = virtinfo.split("\n")
3136N/A+ virtinfo = virtinfo[0] # Doesn't need to check each logical-domain class
3136N/A+
3136N/A+ case virtinfo
3136N/A+ when "supported"
3136N/A+ virtinfo
3136N/A+ when "current"
3136N/A+ # Even control domain can have "logical_domain => current"
3136N/A+ # To verify, control-role property should be examined.
3136N/A+ ctrl_role = %x{virtinfo -c current get -Ho value control-role logical-domain 2> /dev/null}
3136N/A+ case ctrl_role.chomp!
3136N/A+ when "true"
3136N/A+ "supported"
3136N/A+ when "false"
3136N/A+ virtinfo
3136N/A+ end
3136N/A+ else
3136N/A+ "unsupported"
3136N/A+ end
3136N/A+ end
3136N/A+ end
3136N/A end