Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions Cargo.lock

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

64 changes: 64 additions & 0 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ enum SledSetCommand {
Policy(SledSetPolicyArgs),
#[clap(flatten)]
Visibility(SledSetVisibilityCommand),
/// set the mupdate override for this sled
MupdateOverride(SledSetMupdateOverrideArgs),
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -502,6 +504,23 @@ struct SledUpdateSpArgs {
inactive: Option<ExpectedVersion>,
}

#[derive(Debug, Args)]
struct SledSetMupdateOverrideArgs {
#[clap(flatten)]
source: SledMupdateOverrideSource,
}

#[derive(Debug, Args)]
#[group(id = "sled-mupdate-override-source", required = true, multiple = false)]
struct SledMupdateOverrideSource {
/// the new value of the mupdate override, or "unset"
mupdate_override_id: Option<MupdateOverrideUuidOpt>,

/// simulate an error reading the mupdate override
#[clap(long, conflicts_with = "mupdate_override_id")]
with_error: bool,
}

#[derive(Debug, Args)]
struct SledRemoveArgs {
/// id of the sled
Expand Down Expand Up @@ -1347,6 +1366,51 @@ fn cmd_sled_set(
)))
}
}
SledSetCommand::MupdateOverride(SledSetMupdateOverrideArgs {
source:
SledMupdateOverrideSource { mupdate_override_id, with_error },
}) => {
let (desc, prev) = if with_error {
let prev =
system.description_mut().sled_set_mupdate_override_error(
sled_id,
"reconfigurator-cli simulated mupdate-override error"
.to_owned(),
)?;
("error".to_owned(), prev)
} else {
let mupdate_override_id =
mupdate_override_id.expect("clap ensures that this is set");
let prev = system.description_mut().sled_set_mupdate_override(
sled_id,
mupdate_override_id.into(),
)?;
let desc = match mupdate_override_id {
MupdateOverrideUuidOpt::Set(id) => id.to_string(),
MupdateOverrideUuidOpt::Unset => "unset".to_owned(),
};
(desc, prev)
};

let prev_desc = match prev {
Ok(Some(id)) => id.to_string(),
Ok(None) => "unset".to_owned(),
Err(_) => "error".to_owned(),
};

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

Ok(Some(format!(
"set sled {} mupdate override: {} -> {}",
sled_id, prev_desc, desc,
)))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Load an example system.

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

# Create a TUF repository from a fake manifest. We're going to use this
# repository to test out the minimum release generation flow.
tuf-assemble ../../update-common/manifests/fake.toml
set target-release repo-1.0.0.zip

# Update the install dataset on this sled to the target release.
# (This populates the zone manifest, used for no-op conversions from
# install dataset to artifact down the road.)
sled-update-install-dataset serial0 --to-target-release
# Simulate a mupdate on sled 0 by setting the mupdate override field to a
# new UUID (generated using uuidgen).
sled-set serial0 mupdate-override 6123eac1-ec5b-42ba-b73f-9845105a9971

# On sled 1, simulate an error obtaining the mupdate override.
sled-set serial1 mupdate-override --with-error

# Simulate a mupdate on sled 2 as well.
sled-set serial2 mupdate-override 203fa72c-85c1-466a-8ed3-338ee029530d

# Generate an inventory and display it.
#
# TODO: in the future, we'll plan against this inventory.
inventory-generate
inventory-show latest
33 changes: 33 additions & 0 deletions dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,17 @@ LEDGERED SLED CONFIG
b61b7c3c-d665-44b3-9312-794aa81c59de crucible install-dataset
b957d6cf-f7b2-4bee-9928-c5fde8c59e04 crucible install-dataset
e246f5e3-0650-4afc-860f-ee7114d309c5 crucible install-dataset
zone image resolver status:
zone manifest:
path on boot disk: /fake/path/install/zones.json
boot disk inventory:
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
no artifacts in install dataset (this should only be seen in simulated systems)
no non-boot disks
mupdate override:
path on boot disk: /fake/path/install/mupdate_override.json
no override on boot disk
no non-boot disks
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
slot A details UNAVAILABLE: constructed via debug_assume_success()
slot B details UNAVAILABLE: constructed via debug_assume_success()
Expand Down Expand Up @@ -1204,6 +1215,17 @@ LEDGERED SLED CONFIG
6c2a57b0-2de0-4409-a6b9-c9aa5614eefa crucible install-dataset
99a750b2-724d-4828-ae5f-0df1aad90166 crucible install-dataset
e668d83e-a28c-42dc-b574-467e57403cc1 crucible install-dataset
zone image resolver status:
zone manifest:
path on boot disk: /fake/path/install/zones.json
boot disk inventory:
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
no artifacts in install dataset (this should only be seen in simulated systems)
no non-boot disks
mupdate override:
path on boot disk: /fake/path/install/mupdate_override.json
no override on boot disk
no non-boot disks
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
slot A details UNAVAILABLE: constructed via debug_assume_success()
slot B details UNAVAILABLE: constructed via debug_assume_success()
Expand Down Expand Up @@ -1393,6 +1415,17 @@ LEDGERED SLED CONFIG
dc2666e6-4c3e-4b8e-99bc-bcdb5f8986e1 crucible_pantry install-dataset
f4dc5b5d-6eb6-40a9-a079-971eca862285 crucible install-dataset
ffbf02f0-261d-4723-b613-eb861245acbd internal_dns install-dataset
zone image resolver status:
zone manifest:
path on boot disk: /fake/path/install/zones.json
boot disk inventory:
manifest generated by installinator (mupdate ID: 00000000-0000-0000-0000-000000000000)
no artifacts in install dataset (this should only be seen in simulated systems)
no non-boot disks
mupdate override:
path on boot disk: /fake/path/install/mupdate_override.json
no override on boot disk
no non-boot disks
boot disk slot: FAILED TO DETERMINE: constructed via debug_assume_success()
slot A details UNAVAILABLE: constructed via debug_assume_success()
slot B details UNAVAILABLE: constructed via debug_assume_success()
Expand Down
Loading
Loading