Skip to content

Commit

Permalink
Merge pull request #14026 from lenovo/add_phys_host_relationship
Browse files Browse the repository at this point in the history
Adds host to physical server relationship
  • Loading branch information
blomquisg authored Mar 24, 2017
2 parents 78ac336 + 3c72c7e commit 684f835
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/api/physical_servers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Api
class PhysicalServersController < BaseController
end
end
3 changes: 3 additions & 0 deletions app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class Host < ApplicationRecord
has_many :host_aggregate_hosts, :dependent => :destroy
has_many :host_aggregates, :through => :host_aggregate_hosts

# Physical server reference
belongs_to :physical_server, :inverse_of => :host

serialize :settings, Hash

deprecate_attribute :address, :hostname
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class PhysicalServer < ApplicationRecord

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

has_one :host, inverse_of => :physical_server

def name_with_details
details % {
:name => name,
Expand Down

0 comments on commit 684f835

Please sign in to comment.