Skip to content

Commit

Permalink
Merge pull request #17863 from hstastna/Error_refresh_relationships_v…
Browse files Browse the repository at this point in the history
…m_instance

Fix Refresh Relationships and Power States button for VMs, Instances, Images
  • Loading branch information
agrare authored Sep 4, 2018
2 parents 1646567 + 493d20f commit b1acd59
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ExtManagementSystem < ApplicationRecord
include CustomActionsMixin
include SupportsFeatureMixin

def self.types
leaf_subclasses.collect(&:ems_type)
Expand Down Expand Up @@ -90,6 +91,8 @@ def self.api_allowed_attributes

serialize :options

supports :refresh_ems

def hostname_uniqueness_valid?
return unless hostname_required?
return unless hostname.present? # Presence is checked elsewhere
Expand Down
1 change: 1 addition & 0 deletions app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class Host < ApplicationRecord
unsupported_reason_add(:reset, _("The Host has invalid IPMI credentials"))
end
end
supports :refresh_ems

def self.non_clustered
where(:ems_cluster_id => nil)
Expand Down
1 change: 1 addition & 0 deletions app/models/mixins/supports_feature_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ module SupportsFeatureMixin
:reconfigure_disksize => 'Reconfigure Virtual Machines Disk Size',
:reconfigure_network_adapters => 'Reconfigure Network Adapters',
:reconfigure_cdroms => 'Reconfigure Virtual Machines CD/DVDs',
:refresh_ems => 'Refresh Relationships and Power States',
:refresh_network_interfaces => 'Refresh Network Interfaces for a Host',
:refresh_new_target => 'Refresh non-existing record',
:regions => 'Regions of a Provider',
Expand Down
1 change: 1 addition & 0 deletions app/models/orchestration_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OrchestrationStack < ApplicationRecord
alias_method :orchestration_stack_outputs, :outputs
alias_method :orchestration_stack_resources, :resources

supports :refresh_ems
supports :retire

def orchestration_stacks
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_chassis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class PhysicalChassis < ApplicationRecord
has_one :asset_detail, :as => :resource, :dependent => :destroy, :inverse_of => false
has_many :guest_devices, :through => :hardware

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
4 changes: 4 additions & 0 deletions app/models/physical_rack.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class PhysicalRack < ApplicationRecord
include SupportsFeatureMixin

acts_as_miq_taggable

belongs_to :ext_management_system, :foreign_key => :ems_id, :inverse_of => :physical_racks,
Expand All @@ -7,6 +9,8 @@ class PhysicalRack < ApplicationRecord
has_many :physical_servers, :dependent => :nullify, :inverse_of => :physical_rack
has_many :physical_storages, :dependent => :nullify, :inverse_of => :physical_rack

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
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 @@ -36,6 +36,8 @@ class PhysicalServer < ApplicationRecord

has_many :physical_switches, :through => :computer_system, :source => :connected_physical_switches

supports :refresh_ems

def name_with_details
details % {
:name => name,
Expand Down
4 changes: 4 additions & 0 deletions app/models/physical_storage.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class PhysicalStorage < ApplicationRecord
include SupportsFeatureMixin

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
Expand All @@ -13,6 +15,8 @@ class PhysicalStorage < ApplicationRecord

has_many :physical_disks, :dependent => :destroy, :inverse_of => :physical_storage

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
2 changes: 2 additions & 0 deletions app/models/physical_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class PhysicalSwitch < Switch

alias_attribute :physical_servers, :connected_physical_servers

supports :refresh_ems

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
Expand Down
3 changes: 3 additions & 0 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Provider < ApplicationRecord
include AuthenticationMixin
include AsyncDeleteMixin
include EmsRefresh::Manager
include SupportsFeatureMixin
include TenancyMixin

belongs_to :tenant
Expand All @@ -20,6 +21,8 @@ class Provider < ApplicationRecord
virtual_column :verify_ssl, :type => :integer
virtual_column :security_protocol, :type => :string

supports :refresh_ems

def self.leaf_subclasses
descendants.select { |d| d.subclasses.empty? }
end
Expand Down
1 change: 1 addition & 0 deletions app/models/vm_or_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,7 @@ def self.includes_template?(ids)

supports_not :snapshots
supports :destroy
supports :refresh_ems

# Stop showing Reconfigure VM task unless the subclass allows
def reconfigurable?
Expand Down

0 comments on commit b1acd59

Please sign in to comment.