Class: Bosh::Director::DeploymentPlan::PlacementPlanner::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/deployment_plan/placement_planner/plan.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance_plan_factory, network_planner, logger) ⇒ Plan

Returns a new instance of Plan.



6
7
8
9
10
# File 'lib/bosh/director/deployment_plan/placement_planner/plan.rb', line 6

def initialize(instance_plan_factory, network_planner, logger)
  @instance_plan_factory = instance_plan_factory
  @network_planner = network_planner
  @logger = logger
end

Instance Method Details

#create_instance_plans(desired, existing, networks, availability_zones, job_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/bosh/director/deployment_plan/placement_planner/plan.rb', line 12

def create_instance_plans(desired, existing, networks, availability_zones, job_name)
  sorted_existing = existing.sort_by(&:index)
  instance_plans = assign_zones(desired, sorted_existing, networks, availability_zones, job_name)

  instance_plans.reject(&:obsolete?).each do |instance_plan|
    @logger.debug("Assigning az '#{instance_plan.desired_instance.availability_zone}' to instance '#{instance_plan.instance}'")
    instance_plan.instance.assign_availability_zone(instance_plan.desired_instance.az)
  end
  instance_plans
end