Class: Wakame::Actions::LaunchCluster

Inherits:
Wakame::Action show all
Defined in:
lib/wakame/actions/launch_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

#action_manager

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

Constructor Details

#initializeLaunchCluster

Returns a new instance of LaunchCluster.



4
5
# File 'lib/wakame/actions/launch_cluster.rb', line 4

def initialize
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wakame/actions/launch_cluster.rb', line 7

def run
  if service_cluster.status == Service::ServiceCluster::STATUS_ONLINE
    Wakame.log.info("Ignore to launch the cluster as is already ONLINE: #{service_cluster.name}")
    return
  end

  levels = service_cluster.dg.levels
  Wakame.log.debug("#{self.class}: Scheduled resource launch order: " + levels.collect {|lv| '['+ lv.collect{|prop| "#{prop.class}" }.join(', ') + ']' }.join(', '))
  acquire_lock { |list|
    levels.each {|lv| list << lv.collect{|res| res.class } }
  }

  levels.each { |lv|
    Wakame.log.info("#{self.class}: Launching resources: #{lv.collect{|prop| "#{prop.class}" }.join(', ')}")
    lv.each { |resource|
      cluster.each_instance(resource) { |svc|
        trigger_action(StartService.new(svc))
      }
    }
    flush_subactions
  }
end