@@ -403,39 +403,7 @@ def parse_vm_guest_devices(lpar, hardware)
403403
404404 # Physical adapters can be assigned to VIOSes and LPARs.
405405 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-
428- persister . guest_devices . build (
429- :hardware => hardware ,
430- :uid_ems => io . dr_name ,
431- :device_type => "physical_port" ,
432- :controller_type => "IO" ,
433- :device_name => "Adapter" ,
434- :location => io . dr_name ,
435- :model => io . description ,
436- :auto_detect => true ,
437- :child_devices => child_devices
438- )
406+ build_io_adapter ( slot . io_adapter , hardware ) unless slot . io_adapter . nil?
439407 end
440408 end
441409
@@ -600,6 +568,39 @@ def build_ethernet_dev(lpar, ent, hardware, controller_type)
600568 )
601569 end
602570
571+ def build_io_adapter ( io , hardware )
572+ # Parse physical adapter ports, if any.
573+ child_devices =
574+ case io
575+ when IbmPowerHmc ::PhysicalFibreChannelAdapter
576+ io . ports . map do |fcs |
577+ persister . guest_devices . build (
578+ :hardware => hardware ,
579+ :uid_ems => fcs . location ,
580+ :device_type => "physical_port" ,
581+ :controller_type => "Fibre channel port" ,
582+ :device_name => fcs . name . nil? ? fcs . location : fcs . name ,
583+ :address => fcs . wwpn ,
584+ :location => fcs . location ,
585+ :model => io . description ,
586+ :auto_detect => true
587+ )
588+ end
589+ end || [ ]
590+
591+ persister . guest_devices . build (
592+ :hardware => hardware ,
593+ :uid_ems => io . dr_name ,
594+ :device_type => "physical_port" ,
595+ :controller_type => "IO" ,
596+ :device_name => "Adapter" ,
597+ :location => io . dr_name ,
598+ :model => io . description ,
599+ :auto_detect => true ,
600+ :child_devices => child_devices
601+ )
602+ end
603+
603604 def self . parse_macaddr ( macaddr )
604605 macaddr . downcase . scan ( /\w {2}/ ) . join ( ':' ) unless macaddr . nil?
605606 end
0 commit comments