-
Notifications
You must be signed in to change notification settings - Fork 62
[reconfigurator] Planner/builder cleanup 2/n: extract DisksEditor #6973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
smklein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the new error variants make sense, and eyeballing this the move seems mostly mechanical.
| pub fn all_sleds( | ||
| &self, | ||
| filter: SledFilter, | ||
| ) -> impl Iterator<Item = (SledUuid, &SledDetails)> + '_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, what made this Clone requirement show up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If github doesn't like that link: the DisksEditor::build() method calls into_*_map for both disks and datasets, both of which want to iterate over the sled IDs.
|
So the CI failure is legit and looks harder to untangle than I expected: |
I think you're right, I think this must have been an oversight for both use-cases. I was focused on the planner-based workflow, I must have not caught these cases. As we discussed offline, I think this is actually an old bug, because |
|
Ok, I think I fixed up reconfigurator-cli and the live tests in 987d4d5: both now call I less-accurately fixed up some |
|
I think this PR is probably still a step in the right direction, in that it makes some of these interactions more obvious, but this DisksEditor / BlueprintBuilder split still doesn't seem right; it's too easy to use incorrectly (e.g., the datastore tests as of this PR). Rereading
Item 2 seems to be problematic for clients other than Do items 4-6 typically only make changes relevant to other changes made in this planning run (e.g., item 4 will only add I'm not really sure what I would expect |
Yeah, this tracks. There's some documentation to this effect in The callsite to
The decision to expunge zones due to disk expungement comes from The callstack is as follows, jumping back and forth between the planner and the builder:
I think this aligns with the conversation we had yesterday: "If you use the planner", we do the right thing. "If you use the builder directly", then, well, YOLO. You're on the hook for completing all steps correctly, so this seems like a pathway we should discourage, since you're right -- we could, as one example of many, forget to expunge zones on expunged disks.
I think this is correct, but it's hard to fully predict the future. The current construction of the builder "conforms" disks to this format, regardless of whether they:
I'm not sure I'm on-board with this pathway - let's compare it to zones on sleds. We could provision all zones to sleds as they become in-service, but the codebase doesn't do that. It walks through all sleds, makes sure they have the zones they need, and also ensures that "rack/fleet"-wide zones also exist on some number of sleds. To me, datasets are equivalent -- sure, there are some datasets that are 1:1 with sleds/zones, but calling
This is a good question, and I think it can be phrased more generally as: "If the reconfigurator-cli wants to take some action that's different from what the planner would do, how do we handle that?" I wonder if, for the reconfigurator-cli case, we should run the actual planner's |
|
We discussed this a bit in chats, and to summarize: Pain
A way out
|
|
Closing this after our discussion yesterday; will reopen something similar but in a different direction related to #6990 |

This is staged on top of #6972 but isn't really dependent on it (it's just to reduce minor diff churn).
Almost all of the diffs in this PR is code moving around:
BlueprintDisksBuilder,BlueprintDatasetsBuilder, andBlueprintSledDatasetsBuildermoved frombuilder.rsto the newdisks_editor.rsBlueprintBuilder::sled_ensure_{disks,datasets}()are now methods on the newBlueprintDisksEditortype (also indisks_editor.rs)BlueprintBuilder::build()now takes an argument (aBlueprintDisksEditor), since the builder itself doesn't hold the changed disks/datasets any morePlannernow holds theBlueprintDisksEditorand calls methods on it instead of where it used to call the same methods onBlueprintBuilderThere were minor changes in the moved code, but should be nothing substantial or behavioral.
BlueprintDisksEditoris the only new thing, but it's just a tiny wrapper around the moved existing stuff.