-
Notifications
You must be signed in to change notification settings - Fork 40
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
Remove ability to generate a Blueprint from an inventory collection #5583
Conversation
.blueprint_disks | ||
.values() | ||
.map(|c| c.disks.len()) | ||
.sum::<usize>() |
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.
This assertion change is, I believe, a fix for a test that was passing incorrectly. blueprint_disks
is a BTreeMap<SledUuid, PhysicalDisksConfig>
, which means blueprint_disks.len()
reported "for how many sleds do we have a PhysicalDisksConfig
?", not "how many disks are in the blueprint" as the check seemed to mean. I think this was passing purely by coincidence:
blueprint1.blueprint_disks
was empty, because a blueprint created from an inventory collection didn't populate it at allnew_sled_zpools
was 4, because we added 4 disksblueprint2.blueprint_disks.len()
was 4, because there are 4 sleds in blueprint2, and going through the builder populatesblueprint_disks
so we were previously passing because 0 + 4 == 4
, even though the units of these values made the comparison nonsensical.
…5584) This builds on #5583; see it for rationale. We remove half of the remaining callers that want to convert `OmicronZoneConfig` into `BlueprintZoneConfig`: * `nexus-test-utils`'s quasi-RSS: This now works in terms of `BlueprintZoneConfig`, and converts down to `OmicronZoneConfig` when necessary. This is the kind of transformation we'd like to make in real RSS, too, although it will be more complex there. * One unit test in `nexus-reconfigurator-execution`: replaced using the `representative()` collection (which includes a collection from a live system, but no blueprint) with the `example()` system (which produces both a collection and a matching blueprint). * Blueprint diffing - the types for the "before" side (which can be a collection or a blueprint) are now wrapped in two-variant enums, with some helpers for comparisons, instead of converting the collection to a blueprint. The remaining users of this conversion direction are the most difficult, but at least we're down to three: * `nexus-db-model` does this conversion to use some shared database serialization logic. This will necessarily change when we add to blueprints, since the serialization logic won't be shared anymore (or at least not _as_ shared). * RSS; see note above. We might be able to handle this like we did `nexus-test-utils`; I'll see when it becomes necessary. * The DNS test that uses data from a live system. Even if the last two have to keep this conversion direction for now (which will become more complex as data is added), at least it's only two! That should be manageable even if the process gets a little messy.
We want to add information in blueprints, particularly
BlueprintZoneConfig
andBlueprintZoneType
, that is not present in the sled-agent typesOmicronZoneConfig
andOmicronZoneType
. Today on main conversion between those types is bidirectional. As we add to blueprints, we will continue to be able to convert aBlueprintZoneConfig
into anOmicronZoneConfig
, but the opposite direction will become more and more difficult as callers need to provide the additional information required for blueprints.We have enough users of the inventory -> blueprint direction that it's quite painful to try to add to blueprints, so this PR attempts to knock out one of the more common uses: converting an inventory collection into a blueprint via
BlueprintBuilder::build_initial_from_collection()
. This method is removed, and all the remaining changes are fallout from that. Most uses of this have been replaced by either the blueprint produced byExampleSystem
or the newBlueprintBuilder::build_empty_with_sleds()
helper for constructing an empty blueprint. One test needed the full blueprint-from-inventory, so that one actually gained a new use of converting OmicronZoneConfig -> BlueprintZoneConfig. (Not ideal, but fine for now!)