Skip to content

Commit

Permalink
Adding PhysicalStorage into PhysicalChassis
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdrasVP committed Jul 17, 2018
1 parent efe1c66 commit b01d027
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def save_physical_storages_inventory(ems, hashes, target = nil)

hashes.each do |h|
h[:physical_rack_id] = h.delete(:physical_rack).try(:[], :id)
h[:physical_chassis_id] = h.delete(:physical_chassis).try(:[], :id)
end

child_keys = %i(computer_system asset_detail)
Expand Down
1 change: 1 addition & 0 deletions app/models/physical_chassis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class PhysicalChassis < ApplicationRecord
belongs_to :physical_rack, :foreign_key => :physical_rack_id, :inverse_of => :physical_chassis

has_many :physical_servers, :dependent => :destroy, :inverse_of => :physical_chassis
has_many :physical_storages, :dependent => :destroy, :inverse_of => :physical_chassis

has_one :computer_system, :as => :managed_entity, :dependent => :destroy, :inverse_of => false
has_one :hardware, :through => :computer_system
Expand Down
2 changes: 1 addition & 1 deletion app/models/physical_rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class PhysicalRack < ApplicationRecord

belongs_to :ext_management_system, :foreign_key => :ems_id, :inverse_of => :physical_racks,
:class_name => "ManageIQ::Providers::PhysicalInfraManager"

has_many :physical_chassis, :dependent => :nullify, :inverse_of => :physical_rack
has_many :physical_servers, :dependent => :nullify, :inverse_of => :physical_rack
has_many :physical_storages, :dependent => :nullify, :inverse_of => :physical_rack

def my_zone
ems = ext_management_system
Expand Down
2 changes: 1 addition & 1 deletion app/models/physical_storage.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class PhysicalStorage < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => :ems_id, :inverse_of => :physical_storages,
:class_name => "ManageIQ::Providers::PhysicalInfraManager"

belongs_to :physical_rack, :foreign_key => :physical_rack_id, :inverse_of => :physical_storages
belongs_to :physical_chassis, :inverse_of => :physical_storages

has_one :computer_system, :as => :managed_entity, :dependent => :destroy, :inverse_of => false
has_one :hardware, :through => :computer_system
Expand Down

0 comments on commit b01d027

Please sign in to comment.