Repository navigation
Conversation
| // | ||
| // This function should not be used for anything other than filtering propolis | ||
| // zones out of the `enabled_smf_services_not_online_by_sled` field | ||
| fn is_propolis_zone(zone: &str) -> bool { |
There was a problem hiding this comment.
This got moved to nexus/types/src/inventory.rs so we can share the implementation (it's simple, but I don't want this to be copy-pasted)
| pub sled_id: DbTypedUuid<SledKind>, | ||
| pub zone_name: String, | ||
| pub fmri: String, | ||
| pub kind: FmFactSmfServiceKind, |
There was a problem hiding this comment.
perhaps nitpicky of me but: kind: FmFactSmfServiceKind feels like it's saying it's the kind of service, and it took me a moment to realize this was the fact kind. But I realize it's a conventional name, so... 🤷♀️
| // --- SMF service diagnosis engine facts --- | ||
| let mut paginator: Paginator<DbTypedUuid<FactKind>> = | ||
| Paginator::new(SQL_BATCH_SIZE, PaginationOrder::Descending); | ||
| while let Some(p) = paginator.next() { | ||
| let batch = paginated( | ||
| fact_smf_dsl::fm_fact_smf_service, | ||
| fact_smf_dsl::id, | ||
| &p.current_pagparams(), | ||
| ) | ||
| .filter(fact_smf_dsl::sitrep_id.eq(id.into_untyped_uuid())) | ||
| .select(model::fm::FmFactSmfService::as_select()) | ||
| .load_async(conn) | ||
| .await | ||
| .map_err(|e| { | ||
| public_error_from_diesel(e, ErrorHandler::Server) | ||
| .internal_context("failed to load SMF service case facts") | ||
| })?; | ||
|
|
||
| paginator = p.found_batch(&batch, &|f| f.id); | ||
| for row in batch { | ||
| let case_id: CaseUuid = row.case_id.into(); | ||
| insert_fact_for_case(&mut by_case, case_id, row.into_fact())?; | ||
| } | ||
| } |
There was a problem hiding this comment.
how many more of these do you think we're gonna have to write before we make a macro that does this?
| }) if !in_maintenance.contains(&( | ||
| service.zone_name.clone(), | ||
| service.fmri.clone(), | ||
| )) => |
There was a problem hiding this comment.
i really thought that BiHashMap worked with tuples of borrowed keys here, but maybe it doesn't? In any case, it's a lil sad we clone this here...
Progress towards #11675. Diagnosis engines can't create Active Problems yet, so this adds a diagnosis engine that opens and closes fault management cases for SMF services in maintenance. Exposing these as Active Problems is left for later work.
What this does
sledtable, the same way in-service disks are.is_propolis_zonefromnexus/src/app/update.rsintonexus_types::inventory, so the update status check and FM share it.SmfServicediagnosis engine, itsfm_fact_smf_servicetable, and the migration that creates them.Behaviour
There is one case per SMF service instance, identified by its sled, zone, and FMRI. Only the
maintenancestate is tracked. Offline, degraded, and unrecognized states are deliberately ignored, as are services in Propolis zones.For each sled, based on its SMF status in the latest inventory:
SvcsCmdError, orDataUnavailablesvcslines (non-emptyerrors)Differences from
contact_supportThe update system's
contact_supportflag currently reports the same condition. This engine intentionally differs from it in two ways:SvcsCmdErrororDataUnavailableas a problem. Being unable to query service health could become its own fault later.Testing