bootstore type reorg PR 5/?: Split internal/external API types: Add ExternalImportExportPolicy#9910
Draft
jgallagher wants to merge 7 commits intomainfrom
Draft
bootstore type reorg PR 5/?: Split internal/external API types: Add ExternalImportExportPolicy#9910jgallagher wants to merge 7 commits intomainfrom
jgallagher wants to merge 7 commits intomainfrom
Conversation
As it evolved, #9570 made various changes to both the sled-agent types crate and the sled-agent API. As it landed, though, it made one versioning bump to sled-agent API (v20 - BGP) and two to the types crate (v20 - lockstep API, v21 - BGP). This squishes the latter two down to just one (v20 - BGP) for consistency with the API's versioning.
This is only used in the sled-agent -> Nexus RSS handoff request in the Nexus lockstep API.
…s-types` This also addresses some lingering TODOs from #9568 about `From` impls being defined in the wrong place per RFD 619.
Contributor
Author
|
Moving this to draft for now based on #9906 (comment). |
8805d4e to
ec816d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ImportExportPolicywas defined inomicron_common::api::external, but was used in the external API, a few internal APIs, and serialized in the bootstore. This PR introducesExternalImportExportPolicy(external API only) and movesImportExportPolicy(the rest) intoomicron_common::api::internal::shared- future work in this chain of PRs will move it again (along with other serialized-in-the-bootstore types), but it has to land there for now.This makes no changes to any internal or external OpenAPI specs - it's only adjusting internal representations.
Part of #9801. Staged on top of #9909.
I'm a lot less sure of some of the types here than with previous PRs in this stack because I'm finding the various
BgpPeer{,Config}types pretty confusing. Some notes on types affected by this change:common::api::internal::shared::BgpPeerConfigis the type serialized in the bootstore and used in internal APIs, so it uses the now-internalImportExportPolicynexus_types::external_api::networking::BgpPeerlooks like the previous type (the internalBgpPeerConfig), but the fields aren't 1-to-1. This is an external type, so it usesExternalImportExportPolicy. (In principle this is fine, and is the point of this PR itself: the external types don't have to map 1-to-1 to internal types! But the names are quite confusing, largely because of the next two bullets.)nexus_types::external_api::networking::BgpPeerConfigalso exists but it's a container for a vec ofnexus_types::external_api::networking::BgpPeers and doesn't look anything at all like the internalBgpPeerConfigin the first bulletnexus/db-queries/src/db/datastore/switch_port.rsalso defines a public (!)BgpPeerConfigstruct that has many common fields with the internalBgpPeerConfigand the externalBgpPeer, but the types of the fields are database flavored (e.g.,SqlU32instead ofu32). This struct is included as a field in the publicSwitchPortSettingsCombinedResulttype defined in the same module that's consumed by a couple of Nexus background tasks. I'm not sure whether this should use the internal or externalImportExportPolicy. I originally had it using the external one (because of the way I thought it was used). In principle it seems like we should limit the external type to the external API, so in 924ca7e I changed it to use the internalImportExportPolicy, but feel free to tell me to revert that commit and go back to external. Weirdly (as you can see in the commit), this change did not affect any of the consumers of thisBgpPeerConfig, and rust-analyzer agrees that these fields are never read by anything. I don't know if they could be removed entirely, or if the fact that they're not being used is an oversight somewhere else.I'm a little tempted to throw up my hands and move
ImportExportPolicyback toomicron_commonand share one type everywhere, but that doesn't seem like the right direction - maybe it would be better to invest time in cleaning up the organization of these BGP types instead? Feedback very welcome.