Skip to content

Commit 66e53e4

Browse files
committed
fm_rendezvous: create requested support bundles and show stats in OMDB
Wire up the FM rendezvous task to create support bundles from sitrep requests via support_bundle_create_for_fm. Add FmSupportBundleStats, collector activator, and OMDB output. Includes tests for bundle creation, idempotency, and capacity errors.
1 parent a2d564f commit 66e53e4

4 files changed

Lines changed: 566 additions & 9 deletions

File tree

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use nexus_types::internal_api::background::DatasetsRendezvousStats;
5959
use nexus_types::internal_api::background::EreporterStatus;
6060
use nexus_types::internal_api::background::FmAlertStats;
6161
use nexus_types::internal_api::background::FmRendezvousStatus;
62+
use nexus_types::internal_api::background::FmSupportBundleStats;
6263
use nexus_types::internal_api::background::InstanceReincarnationStatus;
6364
use nexus_types::internal_api::background::InstanceUpdaterStatus;
6465
use nexus_types::internal_api::background::InventoryLoadStatus;
@@ -3416,9 +3417,14 @@ fn print_task_fm_rendezvous(details: &serde_json::Value) {
34163417
Ok(FmRendezvousStatus::NoSitrep) => {
34173418
println!(" no FM situation report loaded");
34183419
}
3419-
Ok(FmRendezvousStatus::Executed { sitrep_id, alerts }) => {
3420+
Ok(FmRendezvousStatus::Executed {
3421+
sitrep_id,
3422+
alerts,
3423+
support_bundles,
3424+
}) => {
34203425
println!(" current sitrep: {sitrep_id}");
34213426
display_fm_alert_stats(&alerts);
3427+
display_fm_support_bundle_stats(&support_bundles);
34223428
}
34233429
}
34243430
}
@@ -3462,6 +3468,55 @@ fn display_fm_alert_stats(stats: &FmAlertStats) {
34623468
}
34633469
}
34643470

3471+
fn display_fm_support_bundle_stats(stats: &FmSupportBundleStats) {
3472+
let FmSupportBundleStats {
3473+
total_bundles_requested,
3474+
current_sitrep_bundles_requested,
3475+
bundles_created,
3476+
capacity_errors,
3477+
errors,
3478+
} = stats;
3479+
let already_created = total_bundles_requested
3480+
- bundles_created
3481+
- capacity_errors
3482+
- errors.len();
3483+
pub const REQUESTED: &str = "support bundles requested:";
3484+
pub const REQUESTED_THIS_SITREP: &str = " requested in this sitrep:";
3485+
pub const CREATED: &str = " created in this activation:";
3486+
pub const ALREADY_CREATED: &str = " already created:";
3487+
pub const CAPACITY_ERRORS: &str = " capacity errors:";
3488+
pub const ERRORS: &str = " errors:";
3489+
pub const WIDTH: usize = const_max_len(&[
3490+
REQUESTED,
3491+
REQUESTED_THIS_SITREP,
3492+
CREATED,
3493+
ALREADY_CREATED,
3494+
CAPACITY_ERRORS,
3495+
ERRORS,
3496+
]) + 1;
3497+
pub const NUM_WIDTH: usize = 4;
3498+
println!(" {REQUESTED:<WIDTH$}{total_bundles_requested:>NUM_WIDTH$}");
3499+
println!(
3500+
" {REQUESTED_THIS_SITREP:<WIDTH$}{:>NUM_WIDTH$}",
3501+
current_sitrep_bundles_requested
3502+
);
3503+
println!(" {CREATED:<WIDTH$}{bundles_created:>NUM_WIDTH$}");
3504+
println!(" {ALREADY_CREATED:<WIDTH$}{already_created:>NUM_WIDTH$}");
3505+
println!(
3506+
"{} {CAPACITY_ERRORS:<WIDTH$}{:>NUM_WIDTH$}",
3507+
warn_if_nonzero(*capacity_errors),
3508+
capacity_errors
3509+
);
3510+
println!(
3511+
"{} {ERRORS:<WIDTH$}{:>NUM_WIDTH$}",
3512+
warn_if_nonzero(errors.len()),
3513+
errors.len()
3514+
);
3515+
for error in errors {
3516+
println!(" > {error}");
3517+
}
3518+
}
3519+
34653520
fn print_task_trust_quorum_manager(details: &serde_json::Value) {
34663521
let status = match serde_json::from_value::<TrustQuorumManagerStatus>(
34673522
details.clone(),

nexus/src/app/background/init.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,13 @@ impl BackgroundTasksInitializer {
11321132
"updates externally visible database tables to match the \
11331133
current fault management sitrep",
11341134
period: config.fm.rendezvous_period_secs,
1135-
task_impl: Box::new(FmRendezvous::new(datastore.clone(), sitrep_watcher.clone(), task_alert_dispatcher.clone())),
1135+
task_impl: Box::new(FmRendezvous::new(
1136+
datastore.clone(),
1137+
sitrep_watcher.clone(),
1138+
task_alert_dispatcher.clone(),
1139+
task_support_bundle_collector.clone(),
1140+
nexus_id,
1141+
)),
11361142
opctx: opctx.child(BTreeMap::new()),
11371143
watchers: vec![Box::new(sitrep_watcher.clone())],
11381144
activator: task_fm_rendezvous,

0 commit comments

Comments
 (0)