diff --git a/app/models/physical_chassis.rb b/app/models/physical_chassis.rb index 8be696f247e5..2c7236979956 100644 --- a/app/models/physical_chassis.rb +++ b/app/models/physical_chassis.rb @@ -7,10 +7,18 @@ class PhysicalChassis < ApplicationRecord belongs_to :ext_management_system, :foreign_key => :ems_id, :inverse_of => :physical_chassis, :class_name => "ManageIQ::Providers::PhysicalInfraManager" belongs_to :physical_rack, :foreign_key => :physical_rack_id, :inverse_of => :physical_chassis + belongs_to :parent_physical_chassis, + :class_name => "PhysicalChassis", + :inverse_of => :child_physical_chassis has_many :event_streams, :inverse_of => :physical_chassis, :dependent => :nullify has_many :physical_servers, :dependent => :destroy, :inverse_of => :physical_chassis has_many :physical_storages, :dependent => :destroy, :inverse_of => :physical_chassis + has_many :child_physical_chassis, + :class_name => "PhysicalChassis", + :dependent => :destroy, + :foreign_key => :parent_physical_chassis_id, + :inverse_of => :parent_physical_chassis has_one :computer_system, :as => :managed_entity, :dependent => :destroy, :inverse_of => false has_one :hardware, :through => :computer_system