Skip to content

Commit 072d8db

Browse files
committed
Add measurement logic to reconfigurator
1 parent 7c56d21 commit 072d8db

40 files changed

Lines changed: 3955 additions & 585 deletions

dev-tools/reconfigurator-cli/src/lib.rs

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use nexus_reconfigurator_simulation::{
3434
};
3535
use nexus_reconfigurator_simulation::{SimStateBuilder, SimTufRepoSource};
3636
use nexus_reconfigurator_simulation::{SimTufRepoDescription, Simulator};
37+
use nexus_types::deployment::BlueprintMeasurements;
3738
use nexus_types::deployment::ExpectedVersion;
3839
use nexus_types::deployment::execution::blueprint_external_dns_config;
3940
use nexus_types::deployment::execution::blueprint_internal_dns_config;
@@ -720,9 +721,13 @@ struct SledMupdateSource {
720721
mupdate_id: Option<MupdateUuid>,
721722

722723
/// simulate an error reading the zone manifest
723-
#[clap(long, conflicts_with = "sled-mupdate-valid-source")]
724+
#[clap(long, conflicts_with_all = ["sled-mupdate-valid-source", "with_measurement_manifest_error"])]
724725
with_manifest_error: bool,
725726

727+
/// simulate an error reading the measurement manifest
728+
#[clap(long, conflicts_with = "with_manifest_error")]
729+
with_measurement_manifest_error: bool,
730+
726731
/// simulate an error validating zones by this artifact ID name
727732
///
728733
/// This uses the `artifact_id_name` representation of a zone kind.
@@ -732,6 +737,13 @@ struct SledMupdateSource {
732737
requires = "sled-mupdate-valid-source"
733738
)]
734739
with_zone_error: Vec<String>,
740+
/// simulator a measurement corpus error
741+
#[clap(
742+
long,
743+
value_name = "ARTIFACT_ID_NAME",
744+
requires = "sled-mupdate-valid-source"
745+
)]
746+
with_corpus_error: Vec<String>,
735747
}
736748

737749
#[derive(Debug, Args)]
@@ -1014,6 +1026,12 @@ enum BlueprintEditCommands {
10141026
/// This initiates a handoff from the current generation of Nexus zones to
10151027
/// the next generation of Nexus zones.
10161028
BumpNexusGeneration,
1029+
/// Set a sleds measurements to the `unknown` state indicating we can't
1030+
/// rely on the install dataset
1031+
SetSledMeasurementsUnknown {
1032+
/// sled to set the field on
1033+
sled_id: SledOpt,
1034+
},
10171035
}
10181036

10191037
#[derive(Debug, Subcommand)]
@@ -2726,6 +2744,15 @@ fn cmd_blueprint_edit(
27262744
builder.pending_mgs_update_delete(baseboard_id);
27272745
format!("deleted configured update for serial {serial}")
27282746
}
2747+
BlueprintEditCommands::SetSledMeasurementsUnknown { sled_id } => {
2748+
let sled_id = sled_id.to_sled_id(system.description())?;
2749+
builder.sled_set_measurements(
2750+
sled_id,
2751+
BlueprintMeasurements::Unknown,
2752+
)?;
2753+
format!("set sled measurements to 'unknown' {}", sled_id)
2754+
}
2755+
27292756
BlueprintEditCommands::Debug {
27302757
command: BlueprintEditDebugCommands::RemoveSled { sled },
27312758
} => {
@@ -3475,7 +3502,14 @@ fn mupdate_source_to_description(
34753502
format!("from repo at {repo_path}"),
34763503
)?;
34773504
sim_source.simulate_zone_errors(&source.with_zone_error)?;
3478-
Ok(SimTufRepoDescription::new(sim_source))
3505+
if source.with_measurement_manifest_error {
3506+
Ok(SimTufRepoDescription::new_measurement_error(
3507+
sim_source,
3508+
"simulated error with measurement manifest".to_owned(),
3509+
))
3510+
} else {
3511+
Ok(SimTufRepoDescription::new(sim_source))
3512+
}
34793513
} else if source.valid.to_target_release {
34803514
let description = sim
34813515
.current_state()
@@ -3498,7 +3532,14 @@ fn mupdate_source_to_description(
34983532
"to target release".to_owned(),
34993533
)?;
35003534
sim_source.simulate_zone_errors(&source.with_zone_error)?;
3501-
Ok(SimTufRepoDescription::new(sim_source))
3535+
if source.with_measurement_manifest_error {
3536+
Ok(SimTufRepoDescription::new_measurement_error(
3537+
sim_source,
3538+
"simulated error with measurement manifest".to_owned(),
3539+
))
3540+
} else {
3541+
Ok(SimTufRepoDescription::new(sim_source))
3542+
}
35023543
}
35033544
}
35043545
} else if source.with_manifest_error {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Load an example system.
2+
load-example --nsleds 4 --ndisks-per-sled 1
3+
4+
sled-list
5+
6+
# Create a TUF repository from a fake manifest. (The output TUF repo is
7+
# written to a temporary directory that this invocation of `reconfigurator-cli`
8+
# is running out of as its working directory.)
9+
tuf-assemble ../../update-common/manifests/fake.toml
10+
# Create a second TUF repository from a different fake manifest.
11+
tuf-assemble ../../update-common/manifests/fake-non-semver.toml --allow-non-semver
12+
13+
# Load the target release from the first TUF repository.
14+
set target-release repo-1.0.0.zip
15+
16+
# On 3 sleds, update the install dataset.
17+
sled-update-install-dataset serial0 --to-target-release
18+
sled-update-install-dataset serial1 --to-target-release
19+
sled-update-install-dataset serial2 --to-target-release
20+
21+
# On a fourth sled, simulate an error with the measurement manifest
22+
sled-update-install-dataset serial3 --to-target-release --with-measurement-manifest-error
23+
24+
# Generate an inventory and run a blueprint planning step.
25+
inventory-generate
26+
blueprint-plan latest latest
27+
28+
# This diff should show expected changes to the blueprint.
29+
blueprint-diff latest

dev-tools/reconfigurator-cli/tests/input/cmds-mupdate-update-flow.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ blueprint-diff latest
130130
sled-update-install-dataset serial1 --to-target-release
131131
inventory-generate
132132

133+
# First get our new measurements
134+
blueprint-plan latest latest
135+
blueprint-show latest
136+
blueprint-diff latest
137+
133138
# This will attempt to update the RoT bootloader on the first sled.
134139
blueprint-plan latest latest
135140
blueprint-show latest
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Load an example system.
2+
load-example --nsleds 4 --ndisks-per-sled 1
3+
4+
sled-list
5+
6+
# Create a TUF repository from a fake manifest. (The output TUF repo is
7+
# written to a temporary directory that this invocation of `reconfigurator-cli`
8+
# is running out of as its working directory.)
9+
tuf-assemble ../../update-common/manifests/fake.toml
10+
# Create a second TUF repository from a different fake manifest.
11+
tuf-assemble ../../update-common/manifests/fake-non-semver.toml --allow-non-semver
12+
13+
# Load the target release from the first TUF repository.
14+
set target-release repo-1.0.0.zip
15+
16+
# On 4 sleds, update the install dataset.
17+
sled-update-install-dataset serial0 --to-target-release
18+
sled-update-install-dataset serial1 --to-target-release
19+
sled-update-install-dataset serial2 --to-target-release
20+
sled-update-install-dataset serial3 --to-target-release
21+
22+
# mark sled 2 with being 'unknown'
23+
blueprint-edit latest set-sled-measurements-unknown serial2
24+
25+
# Generate an inventory and run a blueprint planning step.
26+
inventory-generate
27+
blueprint-plan latest latest
28+
29+
# This diff should show sled2 still picking up the measurements
30+
blueprint-diff latest

dev-tools/reconfigurator-cli/tests/output/cmds-add-sled-no-disks-stdout

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ planning report:
5050
* no zpools in service for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
5151
* discretionary zone placement waiting for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
5252
* zone updates waiting on zone add blockers
53+
Measurement updates:
54+
Blocked on add/updates
5355

5456

5557

@@ -358,6 +360,8 @@ planning report:
358360
* no zpools in service for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
359361
* discretionary zone placement waiting for NTP zones on sleds: 00320471-945d-413c-85e7-03e091a70b3c
360362
* zone updates waiting on zone add blockers
363+
Measurement updates:
364+
Blocked on add/updates
361365

362366

363367

dev-tools/reconfigurator-cli/tests/output/cmds-add-zones-with-mupdate-override-stdout

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,18 @@ INFO blueprint mupdate override updated to match inventory, phase: do_plan_mupda
8383
, host_phase_2:
8484
- host phase 2 slot A: current contents (unchanged)
8585
- host phase 2 slot B: current contents (unchanged)
86-
86+
, measurements: (unknown)
8787
INFO no previous MGS update found as part of updating blueprint mupdate override to match inventory, phase: do_plan_mupdate_override, sled_id: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6
8888
INFO updating target release minimum generation based on new set-override actions, phase: do_plan_mupdate_override, current_generation: 1, new_generation: 3
8989
INFO performed noop zone image source checks on sled, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, num_total: 9, num_already_artifact: 0, num_eligible: 0, num_ineligible: 9
9090
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
9191
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
92+
INFO current sled measurements are in an unknown state, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
9293
INFO skipped noop image source check on sled, sled_id: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6, reason: remove_mupdate_override is set in the blueprint (2d0f6cbc-addc-47a2-962a-6a01e13376bf)
9394
INFO performed noop zone image source checks on sled, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, num_total: 8, num_already_artifact: 0, num_eligible: 0, num_ineligible: 8
9495
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
9596
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
97+
INFO current sled measurements are in an unknown state, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763
9698
generated blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 based on parent blueprint dbcbd3d6-41ff-48ae-ac0b-1becc9b2fd21
9799
blueprint source: planner with report:
98100
planning report:
@@ -107,6 +109,8 @@ planning report:
107109

108110
* zone updates waiting on zone add blockers
109111
* waiting to update top-level nexus_generation: some non-Nexus zone are not yet updated
112+
Measurement updates:
113+
Blocked on add/updates
110114

111115

112116

@@ -123,10 +127,11 @@ to: blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
123127
+ will remove mupdate override: (none) -> 2d0f6cbc-addc-47a2-962a-6a01e13376bf
124128

125129
measurements:
126-
---------------------------
127-
hash version
128-
---------------------------
129-
unknown (unknown version)
130+
-----------------------------------
131+
hash version
132+
-----------------------------------
133+
- unknown (unknown version)
134+
+ install dataset (no version)
130135

131136

132137
host phase 2 contents:
@@ -227,10 +232,12 @@ target number of Nexus zones: None -> 4
227232
INFO performed noop zone image source checks on sled, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, num_total: 9, num_already_artifact: 0, num_eligible: 0, num_ineligible: 9
228233
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
229234
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
235+
INFO current sled measurements are in an unknown state, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
230236
INFO skipped noop image source check on sled, sled_id: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6, reason: remove_mupdate_override is set in the blueprint (2d0f6cbc-addc-47a2-962a-6a01e13376bf)
231237
INFO performed noop zone image source checks on sled, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, num_total: 8, num_already_artifact: 0, num_eligible: 0, num_ineligible: 8
232238
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
233239
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
240+
INFO current sled measurements are in an unknown state, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763
234241
generated blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4 based on parent blueprint 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1
235242
blueprint source: planner with report:
236243
planning report:
@@ -245,6 +252,8 @@ planning report:
245252

246253
* zone updates waiting on zone add blockers
247254
* waiting to update top-level nexus_generation: some non-Nexus zone are not yet updated
255+
Measurement updates:
256+
Blocked on add/updates
248257

249258

250259

@@ -289,10 +298,12 @@ planner config updated:
289298
INFO performed noop zone image source checks on sled, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, num_total: 9, num_already_artifact: 0, num_eligible: 0, num_ineligible: 9
290299
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
291300
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
301+
INFO current sled measurements are in an unknown state, sled_id: 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c
292302
INFO skipped noop image source check on sled, sled_id: 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6, reason: remove_mupdate_override is set in the blueprint (2d0f6cbc-addc-47a2-962a-6a01e13376bf)
293303
INFO performed noop zone image source checks on sled, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, num_total: 8, num_already_artifact: 0, num_eligible: 0, num_ineligible: 8
294304
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: a, expected_hash: 0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a
295305
INFO BootPartitionDetails inventory hash not found in TUF repo, ignoring for noop checks, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763, slot: b, expected_hash: 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
306+
INFO current sled measurements are in an unknown state, sled_id: d81c6a84-79b8-4958-ae41-ea46c9b19763
296307
generated blueprint af934083-59b5-4bf6-8966-6fb5292c29e1 based on parent blueprint 58d5e830-0884-47d8-a7cd-b2b3751adeb4
297308
blueprint source: planner with report:
298309
planning report:
@@ -312,6 +323,8 @@ planner config:
312323
* nexus zone on sled d81c6a84-79b8-4958-ae41-ea46c9b19763 from source install dataset
313324
* zone updates waiting on discretionary zones
314325
* waiting to update top-level nexus_generation: some non-Nexus zone are not yet updated
326+
Measurement updates:
327+
Blocked on add/updates
315328

316329

317330

dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ planning report:
722722

723723
* adding zones despite being blocked, because: target release generation is 1
724724
* zone updates waiting on zone add blockers
725+
Measurement updates:
726+
Blocked on add/updates
725727

726728

727729

@@ -2155,6 +2157,8 @@ planning report:
21552157

21562158
* adding zones despite being blocked, because: target release generation is 1
21572159
* zone updates waiting on zone add blockers
2160+
Measurement updates:
2161+
Blocked on add/updates
21582162

21592163

21602164

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-external-dns-stdout

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,8 @@ planner config:
10781078
* discretionary zones placed:
10791079
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
10801080
* zone updates waiting on discretionary zones
1081+
Measurement updates:
1082+
Blocked on add/updates
10811083

10821084

10831085

@@ -1707,6 +1709,8 @@ planner config:
17071709
* discretionary zones placed:
17081710
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
17091711
* zone updates waiting on discretionary zones
1712+
Measurement updates:
1713+
Blocked on add/updates
17101714

17111715

17121716

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-internal-dns-stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,8 @@ planning report:
808808
* discretionary zones placed:
809809
* internal_dns zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c from source install dataset
810810
* zone updates waiting on discretionary zones
811+
Measurement updates:
812+
Blocked on add/updates
811813

812814

813815

dev-tools/reconfigurator-cli/tests/output/cmds-missing-measurement-manifest-stderr

Whitespace-only changes.

0 commit comments

Comments
 (0)