Class: Wakame::Actions::ShutdownCluster
- Inherits:
-
Wakame::Action
- Object
- Wakame::Action
- Wakame::Actions::ShutdownCluster
- Defined in:
- lib/wakame/actions/shutdown_cluster.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Attribute Summary
Attributes inherited from Wakame::Action
Instance Method Summary collapse
Methods inherited from Wakame::Action
#acquire_lock, #actor_request, #agent_monitor, #all_subactions_complete?, #flush_subactions, #master, #notes, #notify, #on_canceled, #on_failed, #service_cluster, #status=, #subactions, #sync_actor_request, #trigger_action, #walk_subactions
Methods included from ThreadImmutable
#bind_thread, included, #target_thread, #target_thread?, #thread_check
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Instance Method Details
#run ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wakame/actions/shutdown_cluster.rb', line 4 def run levels = cluster.dg.levels Wakame.log.debug("#{self.class}: Resource shutdown order: " + levels.collect {|lv| '['+ lv.collect{|prop| "#{prop.class}" }.join(', ') + ']' }.join(', ')) acquire_lock(levels.map {|lv| lv.map{|res| res.class.to_s } }) levels.reverse.each { |lv| lv.each { |svc_prop| service_cluster.each_instance(svc_prop.class) { |svc_inst| trigger_action(StopService.new(svc_inst)) } } flush_subactions } cluster.cloud_hosts.keys.each { |cloud_host_id| cloud_host = Service::CloudHost.find(cloud_host_id) trigger_action(ShutdownVM.new(cloud_host.agent)) } end |