Skip to content
Open
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
9 changes: 1 addition & 8 deletions dev-tools/omdb/src/bin/omdb/reconfigurator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,7 @@ async fn cmd_reconfigurator_archive(
// successfully archived some blueprints before hitting this error. We
// attempt to notice this and log a message for the operator in this
// case.
let target_blueprint_id = saved_state
.target_blueprint
.context(
"system has no current target blueprint: \
cannot remove non-target blueprints",
)?
.target_id;

let target_blueprint_id = saved_state.target_blueprint.target_id;
let mut ndeleted = 0;

eprintln!("removing saved, non-target blueprints ...");
Expand Down
12 changes: 6 additions & 6 deletions dev-tools/reconfigurator-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2099,12 +2099,12 @@ fn cmd_blueprint_list(
let mut rows = state.system().all_blueprints().collect::<Vec<_>>();
rows.sort_unstable_by_key(|blueprint| blueprint.time_created);
let rows = rows.into_iter().map(|blueprint| {
let (is_target, enabled) = match target_blueprint {
Some(t) if t.target_id == blueprint.id => {
let enabled = if t.enabled { "yes" } else { "no" };
("*", enabled)
}
_ => ("", ""),
let (is_target, enabled) = if target_blueprint.target_id == blueprint.id
{
let enabled = if target_blueprint.enabled { "yes" } else { "no" };
("*", enabled)
} else {
("", "")
};
BlueprintRow {
is_target,
Expand Down
7 changes: 3 additions & 4 deletions dev-tools/reconfigurator-cli/tests/output/cmds-stdout
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ID SERIAL NZPOOLS SUBNET
ID NERRORS TIME_DONE

> blueprint-list
T ENA ID PARENT TIME_CREATED
T ENA ID PARENT TIME_CREATED
* no 00000000-0000-0000-0000-000000000000 <none> <REDACTED_TIMESTAMP>


> sled-show dde1c0e2-b10d-4621-b420-f179f7a7a00a
Expand Down Expand Up @@ -863,14 +864,12 @@ wiped system

> load state.json
loaded data from "state.json"
warnings:
could not determine active Nexus generation from serialized state: no target blueprint set (using default of 1)
result:
system:
using collection 6e066695-94bc-4250-bd63-fd799c166cc1 as source of sled inventory data
loaded sleds: 04ef3330-c682-4a08-8def-fcc4bef31bcd, 90c1102a-b9f5-4d88-92a2-60d54a2d98cc, dde1c0e2-b10d-4621-b420-f179f7a7a00a
loaded collections: 6e066695-94bc-4250-bd63-fd799c166cc1
loaded blueprints: (none)
loaded blueprints: 00000000-0000-0000-0000-000000000000
loaded external IP policy: ExternalIpPolicy { service_pool_ipv4_ranges: [Ipv4Range { first: 192.0.2.2, last: 192.0.2.20 }], service_pool_ipv6_ranges: [], external_dns_ips: {} }
loaded internal DNS generations: (none)
loaded external DNS generations: (none)
Expand Down
2 changes: 1 addition & 1 deletion nexus/reconfigurator/preparation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ pub async fn reconfigurator_state_load(
Ok(UnstableReconfiguratorState {
planning_input,
collections,
target_blueprint: Some(target_blueprint),
target_blueprint,
blueprints,
internal_dns,
external_dns,
Expand Down
17 changes: 11 additions & 6 deletions nexus/reconfigurator/simulation/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl SimConfigBuilder {
external_dns_zone_names: Vec<String>,
silo_names: Vec<Name>,
active_nexus_zones: &BTreeSet<OmicronZoneUuid>,
target_blueprint: Option<&BlueprintTarget>,
target_blueprint: &BlueprintTarget,
all_blueprints: &[Blueprint],
res: &mut LoadSerializedResultBuilder,
) -> LoadSerializedConfigResult {
Expand Down Expand Up @@ -301,7 +301,7 @@ impl SimConfigBuilderInner {
external_dns_zone_names: Vec<String>,
silo_names: Vec<Name>,
active_nexus_zones: &BTreeSet<OmicronZoneUuid>,
target_blueprint: Option<&BlueprintTarget>,
target_blueprint: &BlueprintTarget,
all_blueprints: &[Blueprint],
res: &mut LoadSerializedResultBuilder,
) -> LoadSerializedConfigResult {
Expand Down Expand Up @@ -403,12 +403,17 @@ impl SimConfigBuilderInner {

fn determine_active_nexus_generation(
active_nexus_zones: &BTreeSet<OmicronZoneUuid>,
target_blueprint: Option<&BlueprintTarget>,
target_blueprint: &BlueprintTarget,
all_blueprints: &[Blueprint],
) -> Result<Generation, String> {
let Some(target_blueprint) = target_blueprint else {
return Err("no target blueprint set".to_string());
};
// Real systems always have at least one active Nexus zone, but our
// simulated system has some cases where we have none at all. We'll never be
// able to find the generation matching an empty set, but because this is a
// weird edge case that only applies to simulation, it's also fine to
// default to "the initial generation".
if active_nexus_zones.is_empty() {
return Ok(Generation::new());
}

let Some(blueprint) =
all_blueprints.iter().find(|bp| bp.id == target_blueprint.target_id)
Expand Down
4 changes: 0 additions & 4 deletions nexus/reconfigurator/simulation/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ impl KeyError {
Self { id: ObjectId::Collection(id) }
}

pub(crate) fn blueprint(id: BlueprintId) -> Self {
Self { id: ObjectId::Blueprint(id) }
}

pub(crate) fn resolved_collection(id: ResolvedCollectionId) -> Self {
Self { id: ObjectId::ResolvedCollection(id) }
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/reconfigurator/simulation/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl SimStateBuilder {
state.external_dns_zone_names.clone(),
state.silo_names.clone(),
state.planning_input.active_nexus_zones(),
state.target_blueprint.as_ref(),
&state.target_blueprint,
&state.blueprints,
&mut res,
);
Expand Down
Loading
Loading