Skip to content

Commit

Permalink
Add host_guest_devices assoc and inv collection
Browse files Browse the repository at this point in the history
Remove after ManageIQ/manageiq#17505 is merged
  • Loading branch information
agrare committed Jun 28, 2018
1 parent 29aad86 commit 50346c8
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/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Vmware::InfraManager < InfraManager

has_many :miq_scsi_targets, -> { distinct }, :through => :host_guest_devices
has_many :miq_scsi_luns, -> { distinct }, :through => :miq_scsi_targets
has_many :host_guest_devices, :through => :host_hardwares, :source => :guest_devices

def self.ems_type
@ems_type ||= "vmwarews".freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ def miq_scsi_luns(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 ems_folders(extra_attributes = {})
attributes = {:attributes_blacklist => %i(parent)}
super(attributes.merge(extra_attributes))
Expand Down

0 comments on commit 50346c8

Please sign in to comment.