Skip to content

Commit

Permalink
Merge pull request #18053 from EsdrasVP/add_physical_disks_to_canisters
Browse files Browse the repository at this point in the history
Add PhysicalDisks into Canisters
  • Loading branch information
agrare authored Nov 7, 2018
2 parents 3d2a9b6 + 1b364dc commit 2c598d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/canister.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Canister < ApplicationRecord
has_one :computer_system, :as => :managed_entity, :dependent => :destroy, :inverse_of => false
has_one :hardware, :through => :computer_system

has_many :physical_disks, :dependent => :destroy, :inverse_of => :canister
has_many :guest_devices, :through => :hardware
has_many :physical_network_ports, :through => :guest_devices

Expand Down
4 changes: 2 additions & 2 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def save_physical_disks_inventory(physical_storage, hashes)

# Update the associated ids
hashes.each do |h|
h[:physical_storage_id] = h.delete(:physical_storage).try(:[], :id)
h[:canister_id] = h.delete(:canister).try(:[], :id)
end

save_inventory_multi(physical_storage.physical_disks, hashes, :use_association, [:physical_storage_id])
save_inventory_multi(physical_storage.physical_disks, hashes, :use_association, [:ems_ref])
end

#
Expand Down
1 change: 1 addition & 0 deletions app/models/physical_disk.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class PhysicalDisk < ApplicationRecord
belongs_to :physical_storage, :foreign_key => :physical_storage_id, :inverse_of => :physical_disks
belongs_to :canister, :foreign_key => :canister_id, :inverse_of => :physical_disks

acts_as_miq_taggable
end
1 change: 1 addition & 0 deletions locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ en:
ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalRack: Physical Rack (Lenovo)
ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalChassis: Physical Chassis (Lenovo)
ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalServer: Physical Server (Lenovo)
ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalStorage: Physical Storage (Lenovo)
ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalSwitch: Physical Switch (Lenovo)
ManageIQ::Providers::Redfish::PhysicalInfraManager::PhysicalServer: Physical Server (Redfish)
MeteringContainerImage: Metering for Image
Expand Down

0 comments on commit 2c598d7

Please sign in to comment.