Skip to content

[30/n] blueprint planner logic for mupdate overrides #8456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: sunshowers/spr/main.wip-20n-blueprint-planner-logic-for-mupdate-overrides
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ fn process_command(
Commands::SledShow(args) => cmd_sled_show(sim, args),
Commands::SledSetPolicy(args) => cmd_sled_set_policy(sim, args),
Commands::SledUpdateSp(args) => cmd_sled_update_sp(sim, args),
Commands::SledSetMupdateOverride(args) => {
cmd_sled_set_mupdate_override(sim, args)
}
Commands::SiloList => cmd_silo_list(sim),
Commands::SiloAdd(args) => cmd_silo_add(sim, args),
Commands::SiloRemove(args) => cmd_silo_remove(sim, args),
Expand Down Expand Up @@ -265,6 +268,8 @@ enum Commands {
SledSetPolicy(SledSetPolicyArgs),
/// simulate updating the sled's SP versions
SledUpdateSp(SledUpdateSpArgs),
/// simulate the sled's mupdate override field changing
SledSetMupdateOverride(SledSetMupdateOverrideArgs),

/// list silos
SiloList,
Expand Down Expand Up @@ -390,6 +395,15 @@ struct SledUpdateSpArgs {
inactive: Option<ExpectedVersion>,
}

#[derive(Debug, Args)]
struct SledSetMupdateOverrideArgs {
/// id of the sled
sled_id: SledUuid,

/// the new value of the mupdate override, or "unset"
mupdate_override_id: MupdateOverrideUuidOpt,
}

#[derive(Debug, Args)]
struct SledRemoveArgs {
/// id of the sled
Expand Down Expand Up @@ -993,6 +1007,32 @@ fn cmd_sled_update_sp(
)))
}

fn cmd_sled_set_mupdate_override(
sim: &mut ReconfiguratorSim,
args: SledSetMupdateOverrideArgs,
) -> anyhow::Result<Option<String>> {
let mut state = sim.current_state().to_mut();
state.system_mut().description_mut().sled_set_mupdate_override(
args.sled_id,
args.mupdate_override_id.into(),
)?;

let desc = match args.mupdate_override_id {
MupdateOverrideUuidOpt::Set(id) => format!("set to {id}"),
MupdateOverrideUuidOpt::Unset => "unset".to_owned(),
};

sim.commit_and_bump(
format!(
"reconfigurator-cli sled-set-mupdate-override: {}: {}",
args.sled_id, desc,
),
state,
);

Ok(Some(format!("set sled {} mupdate override: {}", args.sled_id, desc)))
}

fn cmd_inventory_list(
sim: &mut ReconfiguratorSim,
) -> anyhow::Result<Option<String>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Load an example system.

load-example --nsleds 3 --ndisks-per-sled 1

# Set one of the sled's zone's image sources to a specific artifact.
blueprint-edit latest set-zone-image 466a9f29-62bf-4e63-924a-b9efdb86afec artifact 1.2.3 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

# Simulate a mupdate on sled 0 by setting the mupdate override field to a
# new UUID (generated using uuidgen).
sled-set-mupdate-override 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c 6123eac1-ec5b-42ba-b73f-9845105a9971

# Generate a new inventory and plan against that.
inventory-generate
blueprint-plan latest eb0796d5-ab8a-4f7b-a884-b4aeacb8ab51

# Diff the blueprints. This diff should show:
#
# * for sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c, "+ will remove mupdate override"
# * for zone 466a9f29-62bf-4e63-924a-b9efdb86afec, a change from artifact to install-dataset
blueprint-diff 8da82a8e-bf97-4fbd-8ddd-9f6462732cf1 latest

# Now simulate the new config being applied to the sled, which would
# cause the mupdate override to be removed.
sled-set-mupdate-override 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c unset

# Generate a new inventory and plan against that.
inventory-generate
blueprint-plan latest 61f451b3-2121-4ed6-91c7-a550054f6c21

# Diff the blueprints. This diff should show the "remove mupdate
# override" line going away.
# TODO: we do not yet reset the install dataset image back to
# the desired artifact version -- we should do that in the future.
blueprint-diff 58d5e830-0884-47d8-a7cd-b2b3751adeb4 latest

# TODO: set target release

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ parent: afb09faf-a586-4483-9289-04d4f1d8ba23
METADATA:
created by::::::::::::: reconfigurator-cli
created at::::::::::::: <REDACTED_TIMESTAMP>
comment:::::::::::::::: (none)
comment:::::::::::::::: updated target release minimum generation from 1 to 2
internal DNS version::: 1
external DNS version::: 1
target release min gen: 2
Expand Down
2 changes: 2 additions & 0 deletions nexus/reconfigurator/planning/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ chrono.workspace = true
debug-ignore.workspace = true
daft.workspace = true
gateway-client.workspace = true
iddqd.workspace = true
id-map.workspace = true
illumos-utils.workspace = true
indexmap.workspace = true
Expand All @@ -36,6 +37,7 @@ slog-error-chain.workspace = true
sp-sim.workspace = true
static_assertions.workspace = true
strum.workspace = true
swrite.workspace = true
thiserror.workspace = true
tufaceous-artifact.workspace = true
typed-rng.workspace = true
Expand Down
Loading
Loading