Greetings folks
Had not seen this in the facter 1.6.X branch, and I did not see it in the 
2.x branch either (may have missed it).  Posted this to the puppet-users 
group, did not realize it was probably the wrong group.

Here are some patches to get some basic powervm (AIX client os only for 
now) detection to work: works so far for vscsi vios clients, and npiv 
enabled clients.
I probably could come up with a shorter way to handle the npiv detection or 
others may have a nicer way as well.  Tested on powervm 2.1 and 2.2, has 
worked with aix 5.3-7.1 vm's, does not require root privs.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-dev/-/5HZ1XwvjrLgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?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