Class: Bosh::Director::DeploymentPlan::Assembler
- Includes:
- IpUtil, LegacyDeploymentHelper, LockHelper
- Defined in:
- lib/bosh/director/deployment_plan/assembler.rb
Overview
DeploymentPlan::Assembler is used to populate deployment plan with information about existing deployment and information from director DB
Instance Method Summary collapse
- #bind_models(skip_links_binding = false) ⇒ Object
-
#initialize(deployment_plan, stemcell_manager, dns_manager, cloud, logger) ⇒ Assembler
constructor
A new instance of Assembler.
Methods included from LegacyDeploymentHelper
Methods included from IpUtil
#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr
Methods included from LockHelper
#with_compile_lock, #with_deployment_lock, #with_release_lock, #with_release_locks, #with_stemcell_lock
Constructor Details
#initialize(deployment_plan, stemcell_manager, dns_manager, cloud, logger) ⇒ Assembler
Returns a new instance of Assembler.
9 10 11 12 13 14 15 |
# File 'lib/bosh/director/deployment_plan/assembler.rb', line 9 def initialize(deployment_plan, stemcell_manager, dns_manager, cloud, logger) @deployment_plan = deployment_plan @cloud = cloud @logger = logger @stemcell_manager = stemcell_manager @dns_manager = dns_manager end |
Instance Method Details
#bind_models(skip_links_binding = false) ⇒ Object
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 |
# File 'lib/bosh/director/deployment_plan/assembler.rb', line 17 def bind_models(skip_links_binding = false) @logger.info('Binding models') bind_releases migrate_legacy_dns_records network_reservation_repository = Bosh::Director::DeploymentPlan::NetworkReservationRepository.new(@deployment_plan, @logger) states_by_existing_instance = current_states_by_instance(@deployment_plan.candidate_existing_instances) migrate_existing_instances_to_global_networking(network_reservation_repository, states_by_existing_instance) instance_repo = Bosh::Director::DeploymentPlan::InstanceRepository.new(network_reservation_repository, @logger) index_assigner = Bosh::Director::DeploymentPlan::PlacementPlanner::IndexAssigner.new(@deployment_plan.model) instance_plan_factory = Bosh::Director::DeploymentPlan::InstancePlanFactory.new(instance_repo, states_by_existing_instance, @deployment_plan.skip_drain, index_assigner, network_reservation_repository, {'recreate' => @deployment_plan.recreate}) instance_planner = Bosh::Director::DeploymentPlan::InstancePlanner.new(instance_plan_factory, @logger) desired_jobs = @deployment_plan.instance_groups job_migrator = Bosh::Director::DeploymentPlan::JobMigrator.new(@deployment_plan, @logger) desired_jobs.each do |desired_job| desired_instances = desired_job.desired_instances existing_instances = job_migrator.find_existing_instances(desired_job) instance_plans = instance_planner.plan_job_instances(desired_job, desired_instances, existing_instances) desired_job.add_instance_plans(instance_plans) end instance_plans_for_obsolete_jobs = instance_planner.plan_obsolete_jobs(desired_jobs, @deployment_plan.existing_instances) instance_plans_for_obsolete_jobs.map(&:existing_instance).each { |existing_instance| @deployment_plan.mark_instance_for_deletion(existing_instance) } bind_stemcells bind_templates bind_properties bind_instance_networks bind_dns if (!skip_links_binding) bind_links end end |