Skip to content

Commit 3cb178f

Browse files
authored
[inventory] Remove HealthMonitor type but keep health check (#9899)
As per #9876, this patch removes `health_monitor` from the sled agent inventory API and moves `smf_services_in_maintenance` up one level. There are still a few discussions going on in #9876, but what is changed in this PR is not a controversial topic. I'll make further changes once everything in #9876 has been agreed on. ```console $ curl -H "api-version: 22.0.0" http://[::1]:40000/inventory | jq <...> "smf_services_in_maintenance": { "ok": { "services": [ { "fmri": "svc:/site/fake-service2:default", "zone": "global" }, { "fmri": "svc:/site/fake-service:default", "zone": "global" } ], "errors": [], "time_of_status": "2026-02-23T06:23:56.683395426Z" } }, <...> ```
1 parent 6efa919 commit 3cb178f

21 files changed

Lines changed: 10555 additions & 36 deletions

File tree

nexus/db-queries/src/db/datastore/inventory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use diesel::sql_types::Nullable;
2727
use futures::FutureExt;
2828
use futures::future::BoxFuture;
2929
use iddqd::{IdOrdItem, IdOrdMap, id_upcast};
30+
use illumos_utils::svcs::SvcsInMaintenanceResult;
3031
use nexus_db_errors::ErrorHandler;
3132
use nexus_db_errors::public_error_from_diesel;
3233
use nexus_db_errors::public_error_from_diesel_lookup;
@@ -112,7 +113,6 @@ use sled_agent_types::inventory::BootPartitionDetails;
112113
use sled_agent_types::inventory::ConfigReconcilerInventory;
113114
use sled_agent_types::inventory::ConfigReconcilerInventoryResult;
114115
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
115-
use sled_agent_types::inventory::HealthMonitorInventory;
116116
use sled_agent_types::inventory::ManifestNonBootInventory;
117117
use sled_agent_types::inventory::MupdateOverrideNonBootInventory;
118118
use sled_agent_types::inventory::OmicronSledConfig;
@@ -4297,7 +4297,7 @@ impl DataStore {
42974297
file_source_resolver,
42984298
// TODO-K[omicron#9516]: Actually query the DB when there is
42994299
// something there
4300-
health_monitor: HealthMonitorInventory::new(),
4300+
smf_services_in_maintenance: Ok(SvcsInMaintenanceResult::new()),
43014301
reference_measurements: last_reconciliation_measurements
43024302
.remove(&sled_id)
43034303
.unwrap_or_default(),

nexus/db-queries/src/db/datastore/physical_disk.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,16 @@ mod test {
340340
use crate::db::pub_test_utils::helpers::SledUpdateBuilder;
341341
use dropshot::PaginationOrder;
342342
use iddqd::IdOrdMap;
343+
use illumos_utils::svcs::SvcsInMaintenanceResult;
343344
use nexus_db_lookup::LookupPath;
344345
use nexus_types::identity::Asset;
345346
use omicron_common::api::external::ByteCount;
346347
use omicron_common::disk::{DiskIdentity, DiskVariant};
347348
use omicron_test_utils::dev;
348349
use omicron_uuid_kinds::ZpoolUuid;
349350
use sled_agent_types::inventory::{
350-
Baseboard, ConfigReconcilerInventoryStatus, HealthMonitorInventory,
351-
Inventory, InventoryDisk, OmicronFileSourceResolverInventory,
352-
SledCpuFamily, SledRole,
351+
Baseboard, ConfigReconcilerInventoryStatus, Inventory, InventoryDisk,
352+
OmicronFileSourceResolverInventory, SledCpuFamily, SledRole,
353353
};
354354
use std::num::NonZeroU32;
355355

@@ -708,7 +708,9 @@ mod test {
708708
last_reconciliation: None,
709709
file_source_resolver:
710710
OmicronFileSourceResolverInventory::new_fake(),
711-
health_monitor: HealthMonitorInventory::new(),
711+
smf_services_in_maintenance: Ok(
712+
SvcsInMaintenanceResult::new(),
713+
),
712714
reference_measurements: IdOrdMap::new(),
713715
},
714716
)

nexus/inventory/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ impl CollectionBuilder {
675675
reconciler_status: inventory.reconciler_status,
676676
last_reconciliation: inventory.last_reconciliation,
677677
file_source_resolver: inventory.file_source_resolver,
678-
health_monitor: inventory.health_monitor,
678+
smf_services_in_maintenance: inventory.smf_services_in_maintenance,
679679
reference_measurements: inventory.reference_measurements,
680680
};
681681

nexus/inventory/src/examples.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use gateway_client::types::SpComponentCaboose;
1616
use gateway_client::types::SpState;
1717
use gateway_types::rot::RotSlot;
1818
use iddqd::id_ord_map;
19+
use illumos_utils::svcs::SvcsInMaintenanceResult;
1920
use nexus_types::inventory::CabooseWhich;
2021
use nexus_types::inventory::InternalDnsGenerationStatus;
2122
use nexus_types::inventory::RotPage;
@@ -51,7 +52,6 @@ use sled_agent_types::inventory::BootPartitionDetails;
5152
use sled_agent_types::inventory::ConfigReconcilerInventory;
5253
use sled_agent_types::inventory::ConfigReconcilerInventoryResult;
5354
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
54-
use sled_agent_types::inventory::HealthMonitorInventory;
5555
use sled_agent_types::inventory::HostPhase2DesiredSlots;
5656
use sled_agent_types::inventory::Inventory;
5757
use sled_agent_types::inventory::InventoryDataset;
@@ -1090,7 +1090,7 @@ pub fn sled_agent(
10901090
// TODO-K: We'll want to have the functionality to add some services
10911091
// here in a future PR. This will be more useful when we add this
10921092
// information to the DB.
1093-
health_monitor: HealthMonitorInventory::new(),
1093+
smf_services_in_maintenance: Ok(SvcsInMaintenanceResult::new()),
10941094
reference_measurements,
10951095
}
10961096
}

nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ mod api_impl {
198198
use dropshot::StreamingBody;
199199
use dropshot::TypedBody;
200200
use iddqd::IdOrdMap;
201+
use illumos_utils::svcs::SvcsInMaintenanceResult;
201202
use omicron_common::api::external::Generation;
202203
use omicron_common::api::internal::nexus::DiskRuntimeState;
203204
use omicron_common::api::internal::nexus::SledVmmState;
@@ -241,7 +242,6 @@ mod api_impl {
241242
use sled_agent_types::inventory::BootPartitionDetails;
242243
use sled_agent_types::inventory::ConfigReconcilerInventory;
243244
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
244-
use sled_agent_types::inventory::HealthMonitorInventory;
245245
use sled_agent_types::inventory::HostPhase2DesiredContents;
246246
use sled_agent_types::inventory::HostPhase2DesiredSlots;
247247
use sled_agent_types::inventory::Inventory;
@@ -398,7 +398,7 @@ mod api_impl {
398398
non_boot_status: IdOrdMap::new(),
399399
},
400400
},
401-
health_monitor: HealthMonitorInventory::new(),
401+
smf_services_in_maintenance: Ok(SvcsInMaintenanceResult::new()),
402402
reference_measurements: IdOrdMap::new(),
403403
}))
404404
}

nexus/reconfigurator/planning/src/mgs_updates/test_helpers.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use gateway_client::types::SpState;
1313
use gateway_types::rot::RotSlot;
1414
use iddqd::IdOrdItem;
1515
use iddqd::IdOrdMap;
16+
use illumos_utils::svcs::SvcsInMaintenanceResult;
1617
use nexus_types::deployment::BlueprintArtifactVersion;
1718
use nexus_types::deployment::BlueprintHostPhase2DesiredContents;
1819
use nexus_types::deployment::ExpectedVersion;
@@ -39,7 +40,6 @@ use sled_agent_types::inventory::BootPartitionContents;
3940
use sled_agent_types::inventory::BootPartitionDetails;
4041
use sled_agent_types::inventory::ConfigReconcilerInventory;
4142
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
42-
use sled_agent_types::inventory::HealthMonitorInventory;
4343
use sled_agent_types::inventory::HostPhase2DesiredSlots;
4444
use sled_agent_types::inventory::Inventory;
4545
use sled_agent_types::inventory::OmicronFileSourceResolverInventory;
@@ -1371,7 +1371,9 @@ impl<'a> TestBoardCollectionBuilder<'a> {
13711371
ConfigReconcilerInventoryStatus::NotYetRun,
13721372
file_source_resolver:
13731373
OmicronFileSourceResolverInventory::new_fake(),
1374-
health_monitor: HealthMonitorInventory::new(),
1374+
smf_services_in_maintenance: Ok(
1375+
SvcsInMaintenanceResult::new(),
1376+
),
13751377
reference_measurements: IdOrdMap::new(),
13761378
},
13771379
)

nexus/reconfigurator/planning/src/system.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use clickhouse_admin_types::keeper::ClickhouseKeeperClusterMembership;
1212
use gateway_client::types::RotState;
1313
use gateway_client::types::SpComponentCaboose;
1414
use gateway_client::types::SpState;
15+
use illumos_utils::svcs::SvcsInMaintenanceResult;
1516
use indexmap::IndexMap;
1617
use ipnet::Ipv6Net;
1718
use ipnet::Ipv6Subnets;
@@ -61,7 +62,6 @@ use omicron_uuid_kinds::ZpoolUuid;
6162
use sled_agent_types::inventory::Baseboard;
6263
use sled_agent_types::inventory::ConfigReconcilerInventory;
6364
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
64-
use sled_agent_types::inventory::HealthMonitorInventory;
6565
use sled_agent_types::inventory::Inventory;
6666
use sled_agent_types::inventory::InventoryDataset;
6767
use sled_agent_types::inventory::InventoryDisk;
@@ -1471,7 +1471,7 @@ impl Sled {
14711471
// XXX: return something more reasonable here?
14721472
file_source_resolver:
14731473
OmicronFileSourceResolverInventory::new_fake(),
1474-
health_monitor: HealthMonitorInventory::new(),
1474+
smf_services_in_maintenance: Ok(SvcsInMaintenanceResult::new()),
14751475
reference_measurements: iddqd::IdOrdMap::new(),
14761476
}
14771477
};
@@ -1651,7 +1651,7 @@ impl Sled {
16511651
reconciler_status: inv_sled_agent.reconciler_status.clone(),
16521652
last_reconciliation: inv_sled_agent.last_reconciliation.clone(),
16531653
file_source_resolver: inv_sled_agent.file_source_resolver.clone(),
1654-
health_monitor: HealthMonitorInventory::new(),
1654+
smf_services_in_maintenance: Ok(SvcsInMaintenanceResult::new()),
16551655
reference_measurements: inv_sled_agent
16561656
.reference_measurements
16571657
.clone(),

nexus/types/src/inventory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub use gateway_types::rot::RotSlot;
2121
use iddqd::IdOrdItem;
2222
use iddqd::IdOrdMap;
2323
use iddqd::id_upcast;
24+
use illumos_utils::svcs::SvcsInMaintenanceResult;
2425
use omicron_common::api::external::ByteCount;
2526
pub use omicron_common::api::internal::shared::NetworkInterface;
2627
pub use omicron_common::api::internal::shared::NetworkInterfaceKind;
@@ -38,7 +39,6 @@ use serde_with::serde_as;
3839
use sled_agent_types_versions::latest::inventory::ConfigReconcilerInventory;
3940
use sled_agent_types_versions::latest::inventory::ConfigReconcilerInventoryResult;
4041
use sled_agent_types_versions::latest::inventory::ConfigReconcilerInventoryStatus;
41-
use sled_agent_types_versions::latest::inventory::HealthMonitorInventory;
4242
use sled_agent_types_versions::latest::inventory::InventoryDataset;
4343
use sled_agent_types_versions::latest::inventory::InventoryDisk;
4444
use sled_agent_types_versions::latest::inventory::InventoryZpool;
@@ -643,7 +643,7 @@ pub struct SledAgent {
643643
pub reconciler_status: ConfigReconcilerInventoryStatus,
644644
pub last_reconciliation: Option<ConfigReconcilerInventory>,
645645
pub file_source_resolver: OmicronFileSourceResolverInventory,
646-
pub health_monitor: HealthMonitorInventory,
646+
pub smf_services_in_maintenance: Result<SvcsInMaintenanceResult, String>,
647647
pub reference_measurements: IdOrdMap<SingleMeasurementInventory>,
648648
}
649649

nexus/types/src/inventory/display.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ fn display_sleds(
619619
reconciler_status,
620620
last_reconciliation,
621621
file_source_resolver,
622-
health_monitor,
622+
smf_services_in_maintenance,
623623
reference_measurements,
624624
} = sled;
625625

@@ -900,10 +900,10 @@ fn display_sleds(
900900
// TODO-K[omicron#9516]: This is temporarily hidden until we add the
901901
// health monitor types to the DB. Once those have been integrated,
902902
// we'll show health monitor status when everything is healthy as well.
903-
if !health_monitor.is_empty() {
903+
if !matches!(smf_services_in_maintenance, Ok(svcs) if svcs.is_empty()) {
904904
writeln!(indented, "HEALTH MONITOR")?;
905905
let mut indent2 = IndentWriter::new(" ", &mut indented);
906-
match &health_monitor.smf_services_in_maintenance {
906+
match smf_services_in_maintenance {
907907
Ok(svcs) => {
908908
if !svcs.is_empty() {
909909
if let Some(time_of_status) = &svcs.time_of_status {

0 commit comments

Comments
 (0)