diff --git a/app/models/manageiq/providers/infra_manager.rb b/app/models/manageiq/providers/infra_manager.rb index 22b608a062b..235ace679ab 100644 --- a/app/models/manageiq/providers/infra_manager.rb +++ b/app/models/manageiq/providers/infra_manager.rb @@ -12,6 +12,7 @@ class InfraManager < BaseManager has_many :host_storages, :through => :hosts has_many :host_switches, :through => :hosts has_many :host_networks, :through => :hosts, :source => :networks + has_many :host_guest_devices, :through => :host_hardwares, :source => :guest_devices has_many :snapshots, :through => :vms_and_templates has_many :switches, -> { distinct }, :through => :hosts has_many :lans, -> { distinct }, :through => :hosts diff --git a/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb b/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb index 0b5896001f8..bf398085d30 100644 --- a/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb +++ b/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb @@ -24,6 +24,14 @@ def guest_devices ) end + def host_guest_devices + add_properties( + :model_class => ::GuestDevice, + :manager_ref => %i(hardware uid_ems), + :parent_inventory_collections => %i(hosts), + ) + end + def host_hardwares add_properties( :model_class => ::Hardware, @@ -32,6 +40,14 @@ def host_hardwares ) end + def host_system_services + add_properties( + :model_class => ::SystemService, + :manager_ref => %i(host name), + :parent_inventory_collections => %i(hosts) + ) + end + def snapshots add_properties( :manager_ref => %i(uid), diff --git a/app/models/manager_refresh/inventory_collection_default/infra_manager.rb b/app/models/manager_refresh/inventory_collection_default/infra_manager.rb index 4684f1e2ac5..3caf830f07b 100644 --- a/app/models/manager_refresh/inventory_collection_default/infra_manager.rb +++ b/app/models/manager_refresh/inventory_collection_default/infra_manager.rb @@ -34,6 +34,29 @@ def host_networks(extra_attributes = {}) attributes.merge!(extra_attributes) end + def host_guest_devices(extra_attributes = {}) + attributes = { + :model_class => ::GuestDevice, + :manager_ref => %i(hardware uid_ems), + :association => :host_guest_devices, + :parent_inventory_collections => [:hosts], + :inventory_object_attributes => %i( + address + controller_type + device_name + device_type + lan + location + network + present + switch + uid_ems + ), + } + + attributes.merge!(extra_attributes) + end + def guest_devices(extra_attributes = {}) attributes = { :model_class => ::GuestDevice, @@ -102,6 +125,16 @@ def snapshots(extra_attributes = {}) attributes.merge!(extra_attributes) end + def host_system_services(extra_attributes = {}) + attributes = { + :model_class => ::SystemService, + :manager_ref => %i(host name), + :parent_inventory_collections => %i(hosts), + } + + attributes.merge!(extra_attributes) + end + def operating_systems(extra_attributes = {}) attributes = { :model_class => ::OperatingSystem,