lib/ohai/plugins/solaris2/virtualization.rb in ohai-7.2.0.alpha.0 vs lib/ohai/plugins/solaris2/virtualization.rb in ohai-7.2.0.rc.0
- old
+ new
@@ -19,10 +19,16 @@
#
Ohai.plugin(:Virtualization) do
provides "virtualization"
+ def collect_solaris_guestid
+ command = '/usr/sbin/zoneadm list -p'
+ so = shell_out(command)
+ so.stdout.split(':').first
+ end
+
collect_data(:solaris2) do
virtualization Mash.new
# Detect KVM/QEMU from cpuinfo, report as KVM
psrinfo_path = Ohai.abs_path( "/usr/sbin/psrinfo" )
@@ -73,9 +79,10 @@
first_zone = zones.keys[0]
unless( first_zone == 'global')
virtualization[:system] = 'zone'
virtualization[:role] = 'guest'
virtualization[:guest_uuid] = zones[first_zone]['uuid']
+ virtualization[:guest_id] = collect_solaris_guestid
end
elsif (zones.length > 1)
virtualization[:system] = 'zone'
virtualization[:role] = 'host'
virtualization[:guests] = zones