Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds host to physical server relationship #14026

Merged
merged 9 commits into from
Mar 24, 2017
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