Multi-CPI Director doesn't needlessly recreate VMs #2384
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During a
bosh deploy
, a multi-CPI multi-IaaS BOSH Director may mistakenly recreate VMs that don't need to be recreated; it confuses the stemcells, thinking that the VM needs a different, wrong stemcell.This commit fixes that error by fine-tuning the stemcell selection process. Specifically, the BOSH Director uses the CPI required by the AZ that the VM is to be placed in to determine which stemcell is desired.
We introduce a new method,
DeploymentPlan::InstancePlan#stemcell_model_for_cpi
, to properly select the stemcell.The source of this stemcell mismatch is from
DeploymentPlan::Stemcell#add_stemcell_models
, where the first stemcell is arbitrarily chosen from an array of stemcells, which may be the correct stemcell for some of the VMs, and the wrong stemcell for others.Although the decision to make the new method
stemcell_model_for_cpi
public is debatable (it should be a private method; it's never called outside the class), it certainly allowed for easier & more thorough testing.Fixes, from
bosh task 14721 --debug
:[Fixes #2363]
What is this change about?
During a
bosh deploy
, a multi-CPI multi-IaaS BOSH Director may mistakenly recreate VMs that don't need to be recreatedPlease provide contextual information.
#2363
What tests have you run against this PR?
Unit tests. And I've hot-patched my multi-CPI BOSH Director and have done new deploys, existing deploys, deleted deployments, uploaded stemcells, cck, etc.
How should this change be described in bosh release notes?
Multi-CPI multi-IaaS BOSH Directors no longer unnecessarily recreate VMs on deploy.
Does this PR introduce a breaking change?
No.