Skip to content

Commit 9d2ef77

Browse files
committed
merge
2 parents eafafe4 + 6d42a02 commit 9d2ef77

File tree

17 files changed

+5201
-414
lines changed

17 files changed

+5201
-414
lines changed

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn process_command(
245245
cmd_sled_update_host_phase_2(sim, args)
246246
}
247247
Commands::SledUpdateRotBootloader(args) => {
248-
cmd_sled_update_rot_bootlaoder(sim, args)
248+
cmd_sled_update_rot_bootloader(sim, args)
249249
}
250250
Commands::SiloList => cmd_silo_list(sim),
251251
Commands::SiloAdd(args) => cmd_silo_add(sim, args),
@@ -402,6 +402,8 @@ struct SledSetArgs {
402402
enum SledSetCommand {
403403
/// set the policy for this sled
404404
Policy(SledSetPolicyArgs),
405+
/// set the Omicron config for this sled from a blueprint
406+
OmicronConfig(SledSetOmicronConfigArgs),
405407
#[clap(flatten)]
406408
Visibility(SledSetVisibilityCommand),
407409
/// set the mupdate override for this sled
@@ -415,6 +417,12 @@ struct SledSetPolicyArgs {
415417
policy: SledPolicyOpt,
416418
}
417419

420+
#[derive(Debug, Args)]
421+
struct SledSetOmicronConfigArgs {
422+
/// the blueprint to derive the Omicron config from
423+
blueprint: BlueprintIdOpt,
424+
}
425+
418426
#[derive(Debug, Subcommand)]
419427
enum SledSetVisibilityCommand {
420428
/// mark a sled hidden from inventory
@@ -1538,6 +1546,30 @@ fn cmd_sled_set(
15381546
);
15391547
Ok(Some(format!("set sled {sled_id} policy to {policy}")))
15401548
}
1549+
SledSetCommand::OmicronConfig(command) => {
1550+
let resolved_id =
1551+
system.resolve_blueprint_id(command.blueprint.into())?;
1552+
let blueprint = system.get_blueprint(&resolved_id)?;
1553+
let sled_cfg =
1554+
blueprint.sleds.get(&sled_id).with_context(|| {
1555+
format!("sled id {sled_id} not found in blueprint")
1556+
})?;
1557+
let omicron_sled_cfg =
1558+
sled_cfg.clone().into_in_service_sled_config();
1559+
system
1560+
.description_mut()
1561+
.sled_set_omicron_config(sled_id, omicron_sled_cfg)?;
1562+
sim.commit_and_bump(
1563+
format!(
1564+
"reconfigurator-cli sled-set omicron-config: \
1565+
{sled_id} from {resolved_id}",
1566+
),
1567+
state,
1568+
);
1569+
Ok(Some(format!(
1570+
"set sled {sled_id} omicron config from {resolved_id}"
1571+
)))
1572+
}
15411573
SledSetCommand::Visibility(command) => {
15421574
let new = command.to_visibility();
15431575
let prev = system
@@ -1636,7 +1668,7 @@ fn cmd_sled_update_install_dataset(
16361668
)))
16371669
}
16381670

1639-
fn cmd_sled_update_rot_bootlaoder(
1671+
fn cmd_sled_update_rot_bootloader(
16401672
sim: &mut ReconfiguratorSim,
16411673
args: SledUpdateRotBootloaderArgs,
16421674
) -> anyhow::Result<Option<String>> {

dev-tools/reconfigurator-cli/tests/input/cmds-target-release.txt

Lines changed: 189 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,195 @@ sled-update-host-phase2 d81c6a84-79b8-4958-ae41-ea46c9b19763 --boot-disk B --slo
223223
sled-update-host-phase1 d81c6a84-79b8-4958-ae41-ea46c9b19763 --active B --slot-b 2053f8594971bbf0a7326c833e2ffc12b065b9d823b9c0b967d275fa595e4e89
224224
inventory-generate
225225

226-
# Do one more planning run. This should update one control plane zone.
226+
# Do another planning run. This should start updating zones (one at a time).
227227
blueprint-plan latest latest
228228
blueprint-diff latest
229229

230-
# We should continue walking through the update. We need to build out a
231-
# reconfigurator-cli subcommand to simulate updated zone image sources (just
232-
# like we have sled-update-sp for simulated SP updates).
230+
# Update the first control plane zone and plan again, which should update the
231+
# next zone on this sled.
232+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
233+
inventory-generate
234+
blueprint-plan latest latest
235+
blueprint-diff latest
236+
237+
# Repeat until all non-Nexus zones on this sled have been updated. Some of these
238+
# steps update a zone in place; others expunge a zone and are followed by a zone
239+
# addition. It doesn't seem _particularly_ useful to spell out which step is
240+
# updating which zone, in terms of keeping this test up to date, but we will
241+
# have to tweak the number of times we iterate on this sled as our simulated
242+
# system or planner placement changes.
243+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
244+
inventory-generate
245+
blueprint-plan latest latest
246+
blueprint-diff latest
247+
248+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
249+
inventory-generate
250+
blueprint-plan latest latest
251+
blueprint-diff latest
252+
253+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
254+
inventory-generate
255+
blueprint-plan latest latest
256+
blueprint-diff latest
257+
258+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
259+
inventory-generate
260+
blueprint-plan latest latest
261+
blueprint-diff latest
262+
263+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
264+
inventory-generate
265+
blueprint-plan latest latest
266+
blueprint-diff latest
267+
268+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
269+
inventory-generate
270+
blueprint-plan latest latest
271+
blueprint-diff latest
272+
273+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
274+
inventory-generate
275+
blueprint-plan latest latest
276+
blueprint-diff latest
277+
278+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
279+
inventory-generate
280+
blueprint-plan latest latest
281+
blueprint-diff latest
282+
283+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
284+
inventory-generate
285+
blueprint-plan latest latest
286+
blueprint-diff latest
287+
288+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
289+
inventory-generate
290+
blueprint-plan latest latest
291+
blueprint-diff latest
292+
293+
# The previous plan updated the last non-Nexus zone on this sled. Nexus comes
294+
# after everything else, so the next step should update the first zone on the
295+
# next sled.
296+
sled-set 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c omicron-config latest
297+
inventory-generate
298+
blueprint-plan latest latest
299+
blueprint-diff latest
300+
301+
# Step through updates of all the non-Nexus zones on this sled.
302+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
303+
inventory-generate
304+
blueprint-plan latest latest
305+
blueprint-diff latest
306+
307+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
308+
inventory-generate
309+
blueprint-plan latest latest
310+
blueprint-diff latest
311+
312+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
313+
inventory-generate
314+
blueprint-plan latest latest
315+
blueprint-diff latest
316+
317+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
318+
inventory-generate
319+
blueprint-plan latest latest
320+
blueprint-diff latest
321+
322+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
323+
inventory-generate
324+
blueprint-plan latest latest
325+
blueprint-diff latest
326+
327+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
328+
inventory-generate
329+
blueprint-plan latest latest
330+
blueprint-diff latest
331+
332+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
333+
inventory-generate
334+
blueprint-plan latest latest
335+
blueprint-diff latest
336+
337+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
338+
inventory-generate
339+
blueprint-plan latest latest
340+
blueprint-diff latest
341+
342+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
343+
inventory-generate
344+
blueprint-plan latest latest
345+
blueprint-diff latest
346+
347+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
348+
inventory-generate
349+
blueprint-plan latest latest
350+
blueprint-diff latest
351+
352+
# The previous plan updated the last non-Nexus zone on this sled. Nexus comes
353+
# after everything else, so the next step should update the first zone on the
354+
# next sled.
355+
sled-set 98e6b7c2-2efa-41ca-b20a-0a4d61102fe6 omicron-config latest
356+
inventory-generate
357+
blueprint-plan latest latest
358+
blueprint-diff latest
359+
360+
# Step through updates of all the non-Nexus zones on this sled.
361+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
362+
inventory-generate
363+
blueprint-plan latest latest
364+
blueprint-diff latest
365+
366+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
367+
inventory-generate
368+
blueprint-plan latest latest
369+
blueprint-diff latest
370+
371+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
372+
inventory-generate
373+
blueprint-plan latest latest
374+
blueprint-diff latest
375+
376+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
377+
inventory-generate
378+
blueprint-plan latest latest
379+
blueprint-diff latest
380+
381+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
382+
inventory-generate
383+
blueprint-plan latest latest
384+
blueprint-diff latest
385+
386+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
387+
inventory-generate
388+
blueprint-plan latest latest
389+
blueprint-diff latest
390+
391+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
392+
inventory-generate
393+
blueprint-plan latest latest
394+
blueprint-diff latest
395+
396+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
397+
inventory-generate
398+
blueprint-plan latest latest
399+
blueprint-diff latest
400+
401+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
402+
inventory-generate
403+
blueprint-plan latest latest
404+
blueprint-diff latest
405+
406+
sled-set d81c6a84-79b8-4958-ae41-ea46c9b19763 omicron-config latest
407+
inventory-generate
408+
blueprint-plan latest latest
409+
blueprint-diff latest
410+
411+
# The previous step updated the last non-Nexus zone on the final sled. We should
412+
# now see a blueprint where every in-service zone (other than Nexus) has an
413+
# image source set to an artifact from our TUF repo.
414+
blueprint-show latest
415+
416+
# We ought to update the inventory for the final sled and then step through
417+
# the Nexus handoff process, but that work is still in progress.

0 commit comments

Comments
 (0)