-
Notifications
You must be signed in to change notification settings - Fork 899
/
cloud_manager.rb
70 lines (60 loc) · 3.19 KB
/
cloud_manager.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module ManageIQ::Providers
class CloudManager < BaseManager
require_nested :AuthKeyPair
require_nested :RefreshParser
require_nested :Template
require_nested :Provision
require_nested :ProvisionWorkflow
require_nested :Vm
require_nested :OrchestrationStack
include AvailabilityMixin
class << model_name
define_method(:route_key) { "ems_clouds" }
define_method(:singular_route_key) { "ems_cloud" }
end
has_many :availability_zones, :foreign_key => :ems_id, :dependent => :destroy
has_many :flavors, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_database_flavors, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_tenants, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_resource_quotas, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_volumes, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_volume_snapshots, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_object_store_containers, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_object_store_objects, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_databases, :foreign_key => :ems_id, :dependent => :destroy
has_many :key_pairs, :class_name => "AuthPrivateKey", :as => :resource, :dependent => :destroy
# TODO(lsmola) NetworkManager, when network manager is integrated to all cloud providers, change below relations
# to delegations to network manager
has_many :floating_ips, :foreign_key => :ems_id, :dependent => :destroy
has_many :security_groups, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_networks, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_subnets, :foreign_key => :ems_id, :dependent => :destroy
has_many :network_ports, :foreign_key => :ems_id, :dependent => :destroy
has_many :network_routers, :foreign_key => :ems_id, :dependent => :destroy
has_many :cloud_services, :foreign_key => :ems_id, :dependent => :destroy
validates_presence_of :zone
include HasManyOrchestrationStackMixin
alias_method :all_cloud_networks, :cloud_networks
# Development helper method for Rails console for opening a browser to the EMS.
#
# This method is NOT meant to be called from production code.
def open_browser
raise NotImplementedError unless Rails.env.development?
require 'util/miq-system'
MiqSystem.open_browser(browser_url)
end
def validate_timeline
{:available => true, :message => nil}
end
def validate_authentication_status
{:available => true, :message => nil}
end
def stop_event_monitor_queue_on_credential_change
if event_monitor_class && !self.new_record? && self.credentials_changed?
_log.info("EMS: [#{name}], Credentials have changed, stopping Event Monitor. It will be restarted by the WorkerMonitor.")
stop_event_monitor_queue
network_manager.stop_event_monitor_queue if respond_to?(:network_manager) && network_manager
end
end
end
end