greetings folks.  wanted to have aix detect if it was under powervm using 
facter.  came up with this hack for facter 1.6.9 which work for vscsi and 
npiv enabled vm's under powervm (so far)...
havent checked the dev facter so something may be in a different branch 
already for facter on this topic...
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/KCDrgcjUoy0J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

--- util/virtual.rb.old 2012-06-07 11:54:11.000000000 -0400
+++ util/virtual.rb     2012-06-25 14:20:11.000000000 -0400
@@ -83,4 +83,10 @@
    def self.zlinux?
     "zlinux"
    end
+
+   def self.powervm?
+    #Facter::Util::Resolution.exec("/usr/bin/odmget -q name=`/usr/bin/getconf 
BOOT_DEVICE` CuDv | /usr/bin/grep PdDvLn").chomp =~ /vdisk/
+    # should work for vscsi and npiv vm's
+    Facter::Util::Resolution.exec("/usr/bin/getconf BOOT_DEVICE | 
/usr/bin/xargs -n 1 /usr/sbin/lsdev -F parent -l | /usr/bin/xargs -n 1 
/usr/sbin/lsdev -F parent -l | /usr/bin/xargs -n 1 /usr/sbin/lsdev -l").chomp 
=~ /Virtual/
+   end
 end
--- virtual.rb.old      2012-06-25 14:23:42.000000000 -0400
+++ virtual.rb  2012-06-07 12:00:38.000000000 -0400
@@ -46,12 +46,16 @@
 
 
 Facter.add("virtual") do
-  confine :kernel => %w{Linux FreeBSD OpenBSD SunOS HP-UX GNU/kFreeBSD}
+  confine :kernel => %w{AIX Linux FreeBSD OpenBSD SunOS HP-UX GNU/kFreeBSD}
 
   result = "physical"
 
   setcode do
 
+    if Facter.value(:kernel)=="AIX" and Facter::Util::Virtual.powervm?
+      result = "powervm"
+    end
+
     if Facter.value(:kernel) == "SunOS" and Facter::Util::Virtual.zone?
       result = "zone"
     end

Reply via email to