@@ -169,8 +169,23 @@ def parse_host_hardware(host, sys)
169169 end
170170
171171 def parse_host_guest_devices ( hardware , sys )
172- sys . io_adapters . each do |io |
173- next if io . udid . to_i == 65_535 # Skip empty slots
172+ sys . io_slots . each do |slot |
173+ io = slot . io_adapter
174+ next if io . nil? || io . udid . to_i == 65_535 # Skip empty slots
175+
176+ child_devices = slot . ior_devices . map do |port |
177+ persister . host_guest_devices . build (
178+ :hardware => hardware ,
179+ :uid_ems => port . location ,
180+ :device_type => "physical_port" ,
181+ :controller_type => "IO" ,
182+ :device_name => "Port" ,
183+ :location => port . location ,
184+ :model => port . description ,
185+ :address => port . macaddr . nil? ? port . wwpn : self . class . parse_macaddr ( port . macaddr ) ,
186+ :auto_detect => true
187+ )
188+ end
174189
175190 persister . host_guest_devices . build (
176191 :hardware => hardware ,
@@ -180,7 +195,8 @@ def parse_host_guest_devices(hardware, sys)
180195 :device_name => "Adapter" ,
181196 :location => io . dr_name ,
182197 :model => io . description ,
183- :auto_detect => true
198+ :auto_detect => true ,
199+ :child_devices => child_devices
184200 )
185201 end
186202 end
@@ -385,8 +401,30 @@ def parse_vm_guest_devices(lpar, hardware)
385401 build_ethernet_dev ( lpar , ent , hardware , "host ethernet adapter" )
386402 end
387403
388- # Physical adapters can be assigned to VIOSes and LPARs using IOMMU.
389- lpar . io_adapters . each do |io |
404+ # Physical adapters can be assigned to VIOSes and LPARs.
405+ lpar . io_slots . each do |slot |
406+ io = slot . io_adapter
407+ next if io . nil?
408+
409+ # Add physical adapter ports, if any.
410+ child_devices =
411+ case io
412+ when IbmPowerHmc ::PhysicalFibreChannelAdapter
413+ io . ports . map do |fcs |
414+ persister . guest_devices . build (
415+ :hardware => hardware ,
416+ :uid_ems => fcs . location ,
417+ :device_type => "physical_port" ,
418+ :controller_type => "Fibre channel port" ,
419+ :device_name => fcs . name . nil? ? fcs . location : fcs . name ,
420+ :address => fcs . wwpn ,
421+ :location => fcs . location ,
422+ :model => io . description ,
423+ :auto_detect => true
424+ )
425+ end
426+ end || [ ]
427+
390428 persister . guest_devices . build (
391429 :hardware => hardware ,
392430 :uid_ems => io . dr_name ,
@@ -395,26 +433,9 @@ def parse_vm_guest_devices(lpar, hardware)
395433 :device_name => "Adapter" ,
396434 :location => io . dr_name ,
397435 :model => io . description ,
398- :auto_detect => true
436+ :auto_detect => true ,
437+ :child_devices => child_devices
399438 )
400-
401- # Add physical adapter ports, if any.
402- case io
403- when IbmPowerHmc ::PhysicalFibreChannelAdapter
404- io . ports . each do |fcs |
405- persister . guest_devices . build (
406- :hardware => hardware ,
407- :uid_ems => fcs . location ,
408- :device_type => "physical_port" ,
409- :controller_type => "Fibre channel port" ,
410- :device_name => fcs . name . nil? ? fcs . location : fcs . name ,
411- :address => fcs . wwpn ,
412- :location => fcs . location ,
413- :model => io . description ,
414- :auto_detect => true
415- )
416- end
417- end
418439 end
419440 end
420441
0 commit comments