Commit 9cfae2c
authored
Break
This PR is pretty widespread and touches some easily-broken bits, so
I'll go into some background here. The replicated bootstore (soon to be
backed by trust quorum instead, but that's not relevant to the context
here) gives an eventually-consistent copy of data to all sleds. The type
exposed by the bootstore is
https://github.com/oxidecomputer/omicron/blob/7c56d21f5fb8127a619cb8557cbcc286e8ae0af7/bootstore/src/schemes/v0/storage.rs#L119-L126
`generation` ensures any write requests from an out-of-date Nexus can't
overwrite newer changes. Prior to this PR, `blob` contains a
JSON-serialized `EarlyNetworkConfig`, defined as
https://github.com/oxidecomputer/omicron/blob/7c56d21f5fb8127a619cb8557cbcc286e8ae0af7/sled-agent/types/versions/src/bgp_v6/early_networking.rs#L23-L35
`EarlyNetworkConfigBody` contains a variety of networking configuration
information required to bring up connectivity on a rack cold boot,
including BGP details, which switches have transceivers and in which
slots, etc. This type is quite complex, and historically changing it has
been quite painful - addressing that is the point of this PR and #9801
in general. This PR does not change `NetworkConfig` or
`EarlyNetworkConfigBody` - the focus is on `EarlyNetworkConfig`. It has
a couple of problems:
* `schema_version` is supposed to tell us what version of `body` is
present, but it's defined _in line_ with the body. That means any time
we rev a new version of `EarlyNetworkConfigBody`, we also have to rev a
new version of `EarlyNetworkConfig`, and don't have an opportunity to
inspect `schema_version` before already needing to know how to
deserialize `body`.
* `generation` is duplicated with the `generation` in `NetworkConfig`.
(This is not nearly as much of a problem in practice as the previous
point, but is an opportunity for illegal states - what would it mean for
a `NetworkConfig` at generation N to hold a blobified
`EarlyNetworkConfig` with a different generation?)
`EarlyNetworkConfig` is used in three places on `main`:
* Serialized as `blob` in the bootstore as described above
* Serialized as `data` in the `bootstore_config` CRDB table (this has
the same "duplicated generation" problem as `NetworkConfig` - this table
also stores `generation` as a separate column next to `data`)
* As the type for the `write_network_bootstore_config()` sled-agent
OpenAPI
This PR breaks `EarlyNetworkConfig` up into two types to address the
problems above. The serialized form is now `EarlyNetworkConfigEnvelope`:
https://github.com/oxidecomputer/omicron/blob/a8de498858cbeb2a58ebf835ccb11b21536de59b/sled-agent/types/versions/src/bootstore_versioning/early_networking.rs#L45-L55
This has `schema_version` and an _opaque_ `body` (typed as
`serde_json::Value`). This fixes both problems with
`EarlyNetworkConfig`:
* `EarlyNetworkConfigEnvelope` does not have to have a new type revved
any time `EarlyNetworkConfigBody`, because `body` is opaque. We can
deserialize the envelope, then inspect `schema_version` to know which
version of `EarlyNetworkConfigBody` it contains. (My hope is we _never_
have to rev this type.)
* No duplicated `generation`.
This is fully backwards-compatible as far as _deserialization_ is
concerned: any existing `EarlyNetworkConfig` can be safely deserialized
as an `EarlyNetworkConfigEnvelope`:
* `schema_version` is unchanged
* `generation` will be ignored
* `body` will be read as a `serde_json::Value` instead of an
`EarlyNetworkConfigBody`
`EarlyNetworkConfigEnvelope` does not implement `JsonSchema`, because it
should not be used in HTTP / OpenAPI contexts; it's only meant to be a
serialization wrapper. That brings us to the second type added in this
PR, `WriteNetworkConfigRequest`:
https://github.com/oxidecomputer/omicron/blob/a8de498858cbeb2a58ebf835ccb11b21536de59b/sled-agent/types/versions/src/bootstore_versioning/early_networking.rs#L38-L42
This is now the type accepted by sled-agent's
`write_network_bootstore_config()` endpoint. sled-agent will convert
this request into a `bootstore::NetworkConfig` in the straightforward
way:
1. Wrap `body` in an `EarlyNetworkConfigEnvelope`
2. Serialize the now-wrapped `body` as `NetworkConfig::blob`
3. Include `generation` as `NetworkConfig::generation`
I believe this gets us most of the way to #9801. I want to do an actual
rev of `EarlyNetworkConfigBody` to confirm this puts us in a good place
(and also work on the mechanics of ensuring that any revs made are
required to update the relevant bits of implementation that need to be
updated, such as `EarlyNetworkConfigEnvelope` knowing how to deserialize
the new body type) before closing the issue. I'll also do some update
testing on a racklette to confirm I didn't break anything w.r.t.
backwards compatibility, but I believe all of these changes should be
safe.
This PR also fixes #9943: sled-agent should never "upconvert"
`EarlyNetworkConfigBody` requests from Nexus into a newer version; it
needs to replicate the exact version it's given.EarlyNetworkConfig up to support cleaner bootstore type changes (#9944)1 parent 9dd2309 commit 9cfae2c
File tree
31 files changed
+1013
-587
lines changed- clients/sled-agent-client/src
- nexus
- db-model/src
- mgs-updates
- src/test_util
- src/app/background/tasks
- test-utils/src
- openapi/sled-agent
- sled-agent
- api
- src
- src
- rack_setup
- sim
- tests
- data
- integration_tests
- types
- src
- early_networking
- versions
- src
- bgp_v6
- bootstore_versioning
- impls
- initial
31 files changed
+1013
-587
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 32 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 33 | | |
44 | 34 | | |
45 | 35 | | |
| |||
50 | 40 | | |
51 | 41 | | |
52 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
| |||
62 | 55 | | |
63 | 56 | | |
64 | 57 | | |
| 58 | + | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
| |||
73 | 67 | | |
74 | 68 | | |
75 | 69 | | |
| 70 | + | |
| 71 | + | |
76 | 72 | | |
77 | 73 | | |
| 74 | + | |
78 | 75 | | |
79 | 76 | | |
80 | 77 | | |
| |||
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
| 89 | + | |
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| 99 | + | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
| 110 | + | |
108 | 111 | | |
109 | 112 | | |
| 113 | + | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
| |||
224 | 223 | | |
225 | 224 | | |
226 | 225 | | |
227 | | - | |
228 | 226 | | |
229 | 227 | | |
230 | 228 | | |
| |||
269 | 267 | | |
270 | 268 | | |
271 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| |||
761 | 762 | | |
762 | 763 | | |
763 | 764 | | |
764 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
765 | 783 | | |
766 | 784 | | |
767 | 785 | | |
768 | | - | |
| 786 | + | |
769 | 787 | | |
770 | | - | |
| 788 | + | |
771 | 789 | | |
772 | 790 | | |
773 | 791 | | |
| |||
0 commit comments