Class: Bosh::Director::DeploymentPlan::PlacementPlanner::AvailabilityZonePicker
- Inherits:
-
Object
- Object
- Bosh::Director::DeploymentPlan::PlacementPlanner::AvailabilityZonePicker
- Defined in:
- lib/bosh/director/deployment_plan/placement_planner/availability_zone_picker.rb
Instance Method Summary collapse
-
#initialize(instance_plan_factory, network_planner, networks, desired_azs) ⇒ AvailabilityZonePicker
constructor
A new instance of AvailabilityZonePicker.
- #place_and_match_in(desired_instances, existing_instance_models) ⇒ Object
Constructor Details
#initialize(instance_plan_factory, network_planner, networks, desired_azs) ⇒ AvailabilityZonePicker
Returns a new instance of AvailabilityZonePicker.
6 7 8 9 10 11 12 |
# File 'lib/bosh/director/deployment_plan/placement_planner/availability_zone_picker.rb', line 6 def initialize(instance_plan_factory, network_planner, networks, desired_azs) @instance_plan_factory = instance_plan_factory @network_planner = network_planner @networks = networks @desired_azs = desired_azs @logger = Config.logger end |
Instance Method Details
#place_and_match_in(desired_instances, existing_instance_models) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bosh/director/deployment_plan/placement_planner/availability_zone_picker.rb', line 14 def place_and_match_in(desired_instances, existing_instance_models) validate_networks_not_changed_for_ignore_vms(existing_instance_models) unplaced_existing_instances = UnplacedExistingInstances.new(existing_instance_models) desired_azs_sorted = unplaced_existing_instances.azs_sorted_by_existing_instance_count_descending(@desired_azs) @logger.debug("Desired azs: #{desired_azs_sorted.inspect}") validate_desired_azs_contains_all_azs_from_ignored_instances(unplaced_existing_instances, desired_instances) placed_instances = PlacedDesiredInstances.new(desired_azs_sorted) remaining_desired_instances_minus_ignored = place_instances_that_have_ignore_flag_as_true(desired_azs_sorted, desired_instances, placed_instances, unplaced_existing_instances) remaining_desired_instances = place_instances_that_have_persistent_disk_in_existing_az(desired_azs_sorted, remaining_desired_instances_minus_ignored, placed_instances, unplaced_existing_instances) balance_across_desired_azs(remaining_desired_instances, placed_instances, unplaced_existing_instances) obsolete_instance_plans(unplaced_existing_instances.unclaimed) + desired_existing_instance_plans(placed_instances.existing) + desired_new_instance_plans(placed_instances.absent) end |