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.

1 change: 1 addition & 0 deletions dev-tools/reconfigurator-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ indent_write.workspace = true
internal-dns-types.workspace = true
itertools.workspace = true
nexus-inventory.workspace = true
nexus-reconfigurator-blippy.workspace = true
nexus-reconfigurator-planning.workspace = true
nexus-reconfigurator-simulation.workspace = true
nexus-sled-agent-shared.workspace = true
Expand Down
16 changes: 16 additions & 0 deletions dev-tools/reconfigurator-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use internal_dns_types::diff::DnsDiff;
use itertools::Itertools;
use log_capture::LogCapture;
use nexus_inventory::CollectionBuilder;
use nexus_reconfigurator_blippy::Blippy;
use nexus_reconfigurator_blippy::BlippyReportSortKey;
use nexus_reconfigurator_planning::blueprint_builder::BlueprintBuilder;
use nexus_reconfigurator_planning::example::ExampleSystemBuilder;
use nexus_reconfigurator_planning::planner::Planner;
Expand Down Expand Up @@ -276,6 +278,7 @@ fn process_entry(
Commands::InventoryList => cmd_inventory_list(sim),
Commands::InventoryGenerate => cmd_inventory_generate(sim),
Commands::BlueprintList => cmd_blueprint_list(sim),
Commands::BlueprintBlippy(args) => cmd_blueprint_blippy(sim, args),
Commands::BlueprintEdit(args) => cmd_blueprint_edit(sim, args),
Commands::BlueprintPlan(args) => cmd_blueprint_plan(sim, args),
Commands::BlueprintShow(args) => cmd_blueprint_show(sim, args),
Expand Down Expand Up @@ -339,6 +342,8 @@ enum Commands {

/// list all blueprints
BlueprintList,
/// run blippy on a blueprint
BlueprintBlippy(BlueprintArgs),
/// run planner to generate a new blueprint
BlueprintPlan(BlueprintPlanArgs),
/// edit contents of a blueprint directly
Expand Down Expand Up @@ -755,6 +760,17 @@ fn cmd_blueprint_list(
Ok(Some(table))
}

fn cmd_blueprint_blippy(
sim: &mut ReconfiguratorSim,
args: BlueprintArgs,
) -> anyhow::Result<Option<String>> {
let state = sim.current_state();
let blueprint = state.system().get_blueprint(args.blueprint_id)?;
let report =
Blippy::new(&blueprint).into_report(BlippyReportSortKey::Severity);
Ok(Some(format!("{}", report.display())))
}

fn cmd_blueprint_plan(
sim: &mut ReconfiguratorSim,
args: BlueprintPlanArgs,
Expand Down
17 changes: 16 additions & 1 deletion nexus/reconfigurator/blippy/src/blippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ pub struct Note {

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum Severity {
/// Indicator of a serious problem that means the blueprint is invalid.
/// Indicates an issue with a blueprint that should be corrected by a future
/// planning run.
BackwardsCompatibility,
/// Indicates a serious problem that means the blueprint is invalid.
Fatal,
}

impl fmt::Display for Severity {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Severity::BackwardsCompatibility => write!(f, "BACKCOMPAT"),
Severity::Fatal => write!(f, "FATAL"),
}
}
Expand Down Expand Up @@ -149,6 +153,8 @@ pub enum SledKind {
ZpoolMissingZoneRootDataset { zpool: ZpoolUuid },
/// A zone's filesystem dataset is missing from `blueprint_datasets`.
ZoneMissingFilesystemDataset { zone: BlueprintZoneConfig },
/// A zone's filesystem pool value is missing from `blueprint_datasets`.
ZoneMissingFilesystemPool { zone: BlueprintZoneConfig },
/// A zone's durable dataset is missing from `blueprint_datasets`.
ZoneMissingDurableDataset { zone: BlueprintZoneConfig },
/// A zone's durable dataset and transient root dataset are on different
Expand Down Expand Up @@ -309,6 +315,15 @@ impl fmt::Display for SledKind {
zone.id,
)
}
SledKind::ZoneMissingFilesystemPool { zone } => {
write!(
f,
"in-service zone's filesytem pool property is missing: \
{:?} {}",
zone.zone_type.kind(),
zone.id,
)
}
SledKind::ZoneMissingDurableDataset { zone } => {
write!(
f,
Expand Down
9 changes: 7 additions & 2 deletions nexus/reconfigurator/blippy/src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,13 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
}
}
None => {
// TODO-john Add a Severity::BackwardsCompatibility and note the
// missing filesystem pool
blippy.push_sled_note(
sled_id,
Severity::BackwardsCompatibility,
SledKind::ZoneMissingFilesystemPool {
zone: zone_config.clone(),
},
);
}
}

Expand Down
Loading