Skip to content
Draft
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
57 changes: 56 additions & 1 deletion dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use nexus_types::internal_api::background::DatasetsRendezvousStats;
use nexus_types::internal_api::background::EreporterStatus;
use nexus_types::internal_api::background::FmAlertStats;
use nexus_types::internal_api::background::FmRendezvousStatus;
use nexus_types::internal_api::background::FmSupportBundleStats;
use nexus_types::internal_api::background::InstanceReincarnationStatus;
use nexus_types::internal_api::background::InstanceUpdaterStatus;
use nexus_types::internal_api::background::InventoryLoadStatus;
Expand Down Expand Up @@ -3416,9 +3417,14 @@ fn print_task_fm_rendezvous(details: &serde_json::Value) {
Ok(FmRendezvousStatus::NoSitrep) => {
println!(" no FM situation report loaded");
}
Ok(FmRendezvousStatus::Executed { sitrep_id, alerts }) => {
Ok(FmRendezvousStatus::Executed {
sitrep_id,
alerts,
support_bundles,
}) => {
println!(" current sitrep: {sitrep_id}");
display_fm_alert_stats(&alerts);
display_fm_support_bundle_stats(&support_bundles);
}
}
}
Expand Down Expand Up @@ -3462,6 +3468,55 @@ fn display_fm_alert_stats(stats: &FmAlertStats) {
}
}

fn display_fm_support_bundle_stats(stats: &FmSupportBundleStats) {
let FmSupportBundleStats {
total_bundles_requested,
current_sitrep_bundles_requested,
bundles_created,
capacity_errors,
errors,
} = stats;
let already_created = total_bundles_requested
- bundles_created
- capacity_errors
- errors.len();
pub const REQUESTED: &str = "support bundles requested:";
pub const REQUESTED_THIS_SITREP: &str = " requested in this sitrep:";
pub const CREATED: &str = " created in this activation:";
pub const ALREADY_CREATED: &str = " already created:";
pub const CAPACITY_ERRORS: &str = " capacity errors:";
pub const ERRORS: &str = " errors:";
pub const WIDTH: usize = const_max_len(&[
REQUESTED,
REQUESTED_THIS_SITREP,
CREATED,
ALREADY_CREATED,
CAPACITY_ERRORS,
ERRORS,
]) + 1;
pub const NUM_WIDTH: usize = 4;
println!(" {REQUESTED:<WIDTH$}{total_bundles_requested:>NUM_WIDTH$}");
println!(
" {REQUESTED_THIS_SITREP:<WIDTH$}{:>NUM_WIDTH$}",
current_sitrep_bundles_requested
);
println!(" {CREATED:<WIDTH$}{bundles_created:>NUM_WIDTH$}");
println!(" {ALREADY_CREATED:<WIDTH$}{already_created:>NUM_WIDTH$}");
println!(
"{} {CAPACITY_ERRORS:<WIDTH$}{:>NUM_WIDTH$}",
warn_if_nonzero(*capacity_errors),
capacity_errors
);
println!(
"{} {ERRORS:<WIDTH$}{:>NUM_WIDTH$}",
warn_if_nonzero(errors.len()),
errors.len()
);
for error in errors {
println!(" > {error}");
}
}

fn print_task_trust_quorum_manager(details: &serde_json::Value) {
let status = match serde_json::from_value::<TrustQuorumManagerStatus>(
details.clone(),
Expand Down
8 changes: 7 additions & 1 deletion nexus/src/app/background/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,13 @@ impl BackgroundTasksInitializer {
"updates externally visible database tables to match the \
current fault management sitrep",
period: config.fm.rendezvous_period_secs,
task_impl: Box::new(FmRendezvous::new(datastore.clone(), sitrep_watcher.clone(), task_alert_dispatcher.clone())),
task_impl: Box::new(FmRendezvous::new(
datastore.clone(),
sitrep_watcher.clone(),
task_alert_dispatcher.clone(),
task_support_bundle_collector.clone(),
nexus_id,
)),
opctx: opctx.child(BTreeMap::new()),
watchers: vec![Box::new(sitrep_watcher.clone())],
activator: task_fm_rendezvous,
Expand Down
Loading
Loading