Skip to content

Commit

Permalink
Add host_guest_devices association inv_collection
Browse files Browse the repository at this point in the history
Add the host_guest_devices association and inventory collection for
graph refresh.
  • Loading branch information
agrare committed May 31, 2018
1 parent f827149 commit 2693c24
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/manageiq/providers/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2693c24

Please sign in to comment.