[reconfigurator] Rework planner/builder expungement logic #7495
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.
The high-level summary of this change is that it moves the logic for handling expunged sleds out of
BlueprintBuilder::expunge_zones_for_sled()(which is now gone entirely) and into a new method on the planner (do_plan_expunge_for_commissioned_sled(), naming suggestions welcome).This fixes two problems; one stylistic, and one semantic:
BlueprintBuilder::expunge_zones_for_sled()was maybe the worst offender for "is this a builder API or a planner API", because a big chunk of its logic was actually delegated back tozone_needs_expungement(), a helper function defined in the planner. The builder now has more explicit and direct methods to expunge specific things, and it's the planner that decides based on the planning input which things to expunge.BlueprintBuilder::expunge_zones_for_sled()only handled expunging zones. When a sled was expunged, at no point did the planner expunge the disks or datasets on that sled. We haven't been bitten by this yet because the builder currently omits expunged sleds fromblueprint_disksandblueprint_datasetsentirely, but that's a major roadblock in the path to joining the maps together (which is a prereq for fixing Reconfigurator "deploy datasets then zones" ordering will break for zone expungement #7309 by merging sled-agent endpoints together).do_plan_expunge_for_commissioned_sled()expunges disks, datasets, and zones. For now we still omit the expunged sleds fromblueprint_disksandblueprint_datasets, but when we stop doing that we'll at least have set the dispositions correctly.