@@ -31,6 +31,7 @@ pub struct FmAnalysis {
3131 inv_rx : watch:: Receiver < Option < Arc < inventory:: Collection > > > ,
3232 activators : Activators ,
3333 nexus_id : OmicronZoneUuid ,
34+ analysis_enabled : bool ,
3435}
3536
3637/// This is just because I don't like it when a constructor takes multiple
@@ -48,7 +49,19 @@ impl BackgroundTask for FmAnalysis {
4849 opctx : & ' a OpContext ,
4950 ) -> BoxFuture < ' a , serde_json:: Value > {
5051 Box :: pin ( async {
51- let status = self . actually_activate ( opctx) . await ;
52+ let status = if self . analysis_enabled {
53+ self . actually_activate ( opctx) . await
54+ } else {
55+ slog:: info!(
56+ opctx. log,
57+ "fault management analysis explicitly disabled by config" ,
58+ ) ;
59+ FmAnalysisStatus {
60+ parent_sitrep_id : None ,
61+ inv_collection_id : None ,
62+ outcome : status:: Outcome :: Disabled ,
63+ }
64+ } ;
5265 match serde_json:: to_value ( status) {
5366 Ok ( val) => val,
5467 Err ( err) => {
@@ -70,8 +83,16 @@ impl FmAnalysis {
7083 inv_rx : watch:: Receiver < Option < Arc < inventory:: Collection > > > ,
7184 activators : Activators ,
7285 nexus_id : OmicronZoneUuid ,
86+ analysis_enabled : bool ,
7387 ) -> Self {
74- Self { datastore, sitrep_rx, inv_rx, activators, nexus_id }
88+ Self {
89+ datastore,
90+ sitrep_rx,
91+ inv_rx,
92+ activators,
93+ nexus_id,
94+ analysis_enabled,
95+ }
7596 }
7697
7798 async fn actually_activate (
@@ -349,6 +370,8 @@ mod tests {
349370 use omicron_test_utils:: dev;
350371 use omicron_uuid_kinds:: SitrepUuid ;
351372
373+ const ANALYSIS_ENABLED : bool = true ;
374+
352375 fn activators ( ) -> Activators {
353376 let a = Activators {
354377 inventory_loader : Activator :: new ( ) ,
@@ -432,6 +455,7 @@ mod tests {
432455 inv_rx,
433456 activators ( ) ,
434457 OmicronZoneUuid :: new_v4 ( ) ,
458+ ANALYSIS_ENABLED ,
435459 ) ;
436460
437461 let result = task. actually_activate ( opctx) . await ;
@@ -464,6 +488,7 @@ mod tests {
464488 inv_rx,
465489 activators ( ) ,
466490 OmicronZoneUuid :: new_v4 ( ) ,
491+ ANALYSIS_ENABLED ,
467492 ) ;
468493
469494 let result = task. actually_activate ( opctx) . await ;
@@ -489,6 +514,7 @@ mod tests {
489514 inv_rx,
490515 activators ( ) ,
491516 OmicronZoneUuid :: new_v4 ( ) ,
517+ ANALYSIS_ENABLED ,
492518 ) ;
493519
494520 let result = task. actually_activate ( opctx) . await ;
@@ -518,6 +544,7 @@ mod tests {
518544 inv_rx,
519545 activators ( ) ,
520546 OmicronZoneUuid :: new_v4 ( ) ,
547+ ANALYSIS_ENABLED ,
521548 ) ;
522549
523550 let result = task. actually_activate ( opctx) . await ;
@@ -547,6 +574,7 @@ mod tests {
547574 inv_rx,
548575 activators ( ) ,
549576 OmicronZoneUuid :: new_v4 ( ) ,
577+ ANALYSIS_ENABLED ,
550578 ) ;
551579
552580 let result = task. actually_activate ( opctx) . await ;
0 commit comments