Skip to content

Commit 772a685

Browse files
authored
[33/n] [nexus-types] add displayers for zone image resolver status (#8619)
Realized that we were missing displayers for the zone image resolver. Write these out, and also test them through reconfigurator-cli via the beginnings of a test for the mupdate/update flow.
1 parent 53aea85 commit 772a685

File tree

10 files changed

+924
-27
lines changed

10 files changed

+924
-27
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ enum SledSetCommand {
381381
Policy(SledSetPolicyArgs),
382382
#[clap(flatten)]
383383
Visibility(SledSetVisibilityCommand),
384+
/// set the mupdate override for this sled
385+
MupdateOverride(SledSetMupdateOverrideArgs),
384386
}
385387

386388
#[derive(Debug, Args)]
@@ -502,6 +504,23 @@ struct SledUpdateSpArgs {
502504
inactive: Option<ExpectedVersion>,
503505
}
504506

507+
#[derive(Debug, Args)]
508+
struct SledSetMupdateOverrideArgs {
509+
#[clap(flatten)]
510+
source: SledMupdateOverrideSource,
511+
}
512+
513+
#[derive(Debug, Args)]
514+
#[group(id = "sled-mupdate-override-source", required = true, multiple = false)]
515+
struct SledMupdateOverrideSource {
516+
/// the new value of the mupdate override, or "unset"
517+
mupdate_override_id: Option<MupdateOverrideUuidOpt>,
518+
519+
/// simulate an error reading the mupdate override
520+
#[clap(long, conflicts_with = "mupdate_override_id")]
521+
with_error: bool,
522+
}
523+
505524
#[derive(Debug, Args)]
506525
struct SledRemoveArgs {
507526
/// id of the sled
@@ -1347,6 +1366,51 @@ fn cmd_sled_set(
13471366
)))
13481367
}
13491368
}
1369+
SledSetCommand::MupdateOverride(SledSetMupdateOverrideArgs {
1370+
source:
1371+
SledMupdateOverrideSource { mupdate_override_id, with_error },
1372+
}) => {
1373+
let (desc, prev) = if with_error {
1374+
let prev =
1375+
system.description_mut().sled_set_mupdate_override_error(
1376+
sled_id,
1377+
"reconfigurator-cli simulated mupdate-override error"
1378+
.to_owned(),
1379+
)?;
1380+
("error".to_owned(), prev)
1381+
} else {
1382+
let mupdate_override_id =
1383+
mupdate_override_id.expect("clap ensures that this is set");
1384+
let prev = system.description_mut().sled_set_mupdate_override(
1385+
sled_id,
1386+
mupdate_override_id.into(),
1387+
)?;
1388+
let desc = match mupdate_override_id {
1389+
MupdateOverrideUuidOpt::Set(id) => id.to_string(),
1390+
MupdateOverrideUuidOpt::Unset => "unset".to_owned(),
1391+
};
1392+
(desc, prev)
1393+
};
1394+
1395+
let prev_desc = match prev {
1396+
Ok(Some(id)) => id.to_string(),
1397+
Ok(None) => "unset".to_owned(),
1398+
Err(_) => "error".to_owned(),
1399+
};
1400+
1401+
sim.commit_and_bump(
1402+
format!(
1403+
"reconfigurator-cli sled-set-mupdate-override: {}: {} -> {}",
1404+
sled_id, prev_desc, desc,
1405+
),
1406+
state,
1407+
);
1408+
1409+
Ok(Some(format!(
1410+
"set sled {} mupdate override: {} -> {}",
1411+
sled_id, prev_desc, desc,
1412+
)))
1413+
}
13501414
}
13511415
}
13521416

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Load an example system.
2+
3+
load-example --nsleds 3 --ndisks-per-sled 1
4+
5+
# Create a TUF repository from a fake manifest. We're going to use this
6+
# repository to test out the minimum release generation flow.
7+
tuf-assemble ../../update-common/manifests/fake.toml
8+
set target-release repo-1.0.0.zip
9+
10+
# Update the install dataset on this sled to the target release.
11+
# (This populates the zone manifest, used for no-op conversions from
12+
# install dataset to artifact down the road.)
13+
sled-update-install-dataset serial0 --to-target-release
14+
# Simulate a mupdate on sled 0 by setting the mupdate override field to a
15+
# new UUID (generated using uuidgen).
16+
sled-set serial0 mupdate-override 6123eac1-ec5b-42ba-b73f-9845105a9971
17+
18+
# On sled 1, simulate an error obtaining the mupdate override.
19+
sled-set serial1 mupdate-override --with-error
20+
21+
# Simulate a mupdate on sled 2 as well.
22+
sled-set serial2 mupdate-override 203fa72c-85c1-466a-8ed3-338ee029530d
23+
24+
# Generate an inventory and display it.
25+
#
26+
# TODO: in the future, we'll plan against this inventory.
27+
inventory-generate
28+
inventory-show latest

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,17 @@ LEDGERED SLED CONFIG
11081108
b61b7c3c-d665-44b3-9312-794aa81c59de crucible install-dataset
11091109
b957d6cf-f7b2-4bee-9928-c5fde8c59e04 crucible install-dataset
11101110
e246f5e3-0650-4afc-860f-ee7114d309c5 crucible install-dataset
1111+
zone image resolver status:
1112+
zone manifest:
1113+
path on boot disk: /fake/path/install/zones.json
1114+
boot disk inventory:
1115+
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
1116+
no artifacts in install dataset (this should only be seen in simulated systems)
1117+
no non-boot disks
1118+
mupdate override:
1119+
path on boot disk: /fake/path/install/mupdate_override.json
1120+
no override on boot disk
1121+
no non-boot disks
11111122
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
11121123
slot A details UNAVAILABLE: constructed via debug_assume_success()
11131124
slot B details UNAVAILABLE: constructed via debug_assume_success()
@@ -1204,6 +1215,17 @@ LEDGERED SLED CONFIG
12041215
6c2a57b0-2de0-4409-a6b9-c9aa5614eefa crucible install-dataset
12051216
99a750b2-724d-4828-ae5f-0df1aad90166 crucible install-dataset
12061217
e668d83e-a28c-42dc-b574-467e57403cc1 crucible install-dataset
1218+
zone image resolver status:
1219+
zone manifest:
1220+
path on boot disk: /fake/path/install/zones.json
1221+
boot disk inventory:
1222+
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
1223+
no artifacts in install dataset (this should only be seen in simulated systems)
1224+
no non-boot disks
1225+
mupdate override:
1226+
path on boot disk: /fake/path/install/mupdate_override.json
1227+
no override on boot disk
1228+
no non-boot disks
12071229
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
12081230
slot A details UNAVAILABLE: constructed via debug_assume_success()
12091231
slot B details UNAVAILABLE: constructed via debug_assume_success()
@@ -1393,6 +1415,17 @@ LEDGERED SLED CONFIG
13931415
dc2666e6-4c3e-4b8e-99bc-bcdb5f8986e1 crucible_pantry install-dataset
13941416
f4dc5b5d-6eb6-40a9-a079-971eca862285 crucible install-dataset
13951417
ffbf02f0-261d-4723-b613-eb861245acbd internal_dns install-dataset
1418+
zone image resolver status:
1419+
zone manifest:
1420+
path on boot disk: /fake/path/install/zones.json
1421+
boot disk inventory:
1422+
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
1423+
no artifacts in install dataset (this should only be seen in simulated systems)
1424+
no non-boot disks
1425+
mupdate override:
1426+
path on boot disk: /fake/path/install/mupdate_override.json
1427+
no override on boot disk
1428+
no non-boot disks
13961429
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
13971430
slot A details UNAVAILABLE: constructed via debug_assume_success()
13981431
slot B details UNAVAILABLE: constructed via debug_assume_success()

dev-tools/reconfigurator-cli/tests/output/cmds-mupdate-update-flow-stderr

Whitespace-only changes.

0 commit comments

Comments
 (0)