Skip to content

Commit

Permalink
Add computer systems to inventory
Browse files Browse the repository at this point in the history
Since computer systems are in 1:1 relation with the physical servers
and carry no data on its own, we add them to the database at the same
time as the servers.
  • Loading branch information
Tadej Borovšak committed Jun 11, 2018
1 parent 5263636 commit 260a668
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def physical_servers
:location_led_state => s["IndicatorLED"],
:physical_rack_id => 0
)
persister.computer_systems.build(:managed_entity => server)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def initialize_inventory_collections
collections = %i(
physical_servers
physical_server_details
computer_systems
)
add_inventory_collections(physical_infra, collections)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class PhysicalInfraManager < ManageIQ::Providers::PhysicalInfraManager
:source => :asset_detail,
:through => :physical_servers,
:as => :physical_server
has_many :computer_systems,
:through => :physical_servers,
:as => :computer_system

def self.ems_type
@ems_type ||= "redfish_ph_infra".freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def assert_ems
expect(ems.physical_servers.count).to eq(1)
expect(ems.physical_servers.map(&:ems_ref)).to match_array([server_id])
expect(ems.physical_server_details.count).to eq(1)
expect(ems.computer_systems.count).to eq(1)
end

def assert_physical_servers
Expand Down

0 comments on commit 260a668

Please sign in to comment.