Skip to content

Conversation

@jgallagher
Copy link
Contributor

@labbott pointed out that adding new sled config versions is quite painful w.r.t. updating the code that reads the ledger, and @bnaecker recently did nontrivial work here (with similar amounts of pain!). Now that done the overall API versioning reorganization work has landed, we can make this a lot cleaner. This PR makes several changes:

  1. Removes the code to convert from the "legacy triple" of configs (the last of which was converted in R16), and all the related tests. The oldest sled config version we support now is v4.
  2. Reworked how we define the order of config versions to attempt; this is now specified in a macro, and adding new versions should be as simple as adding the new version type to the macro invocation (plus minor updates to the tests).
  3. Fixes a (potential but not actual) bug on main - we would try to read the on-disk ledger as v11; if that failed, we'd try to read it as v4, then convert v4 -> v10 -> v11. But we never tried to read it as v10. In this case (IIUC) the v10 -> v11 changes don't affect the on-disk format, so there's no practical impact here. But these changes should make this bug impossible in the future, since the macro defines the order in which we try versions, and we won't skip any.

Most of the lines-of-code changed are in test files. I grabbed a newer v4-sled-config.json from a real system so we'd have some zones with NICs (which is what changed in v4 -> v10) to confirm the tests are actually doing nontrivial conversions.

Comment on lines +263 to +270
// v4 config collected from a test system.
const V4_CONFIG_PATH: &str = "test-data/v4-sled-config.json";

// paths for expectorate checks
const EXPECTORATE_V10_CONFIG_PATH: &str =
"expectorate/v10-sled-config.json";
const EXPECTORATE_V11_CONFIG_PATH: &str =
"expectorate/v11-sled-config.json";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect these tests to get updated for v12?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I realize that's kind of tedious, but it seems pretty important to at least sanity check that we can convert from all prior versions up to the current. Very open to suggestions for any way to make updating these smooth. (I believe as written, the read_config_converts_from_older_versions() won't compile if a new version is added without updating it to account for it. But it should be a couple lines of changes to do so.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants