Skip to content
Open
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
6 changes: 6 additions & 0 deletions dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -1890,6 +1892,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -2134,6 +2138,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -461,6 +463,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -584,6 +588,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -955,6 +957,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -1148,6 +1152,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -939,6 +941,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -1132,6 +1136,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -993,6 +995,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down Expand Up @@ -1186,6 +1190,8 @@ LEDGERED SLED CONFIG
reconciler task status: idle (finished at <REDACTED_TIMESTAMP> after running for <REDACTED_DURATION>s)
reference measurements:
(measurement set is empty)
fmd:
no faults reported

SMF SERVICES STATUS
no data on SMF services has been collected
Expand Down
120 changes: 120 additions & 0 deletions nexus/db-model/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use nexus_db_schema::schema::inv_zone_manifest_zone;
use nexus_db_schema::schema::{
hw_baseboard_id, inv_caboose, inv_clickhouse_keeper_membership,
inv_cockroachdb_status, inv_collection, inv_collection_error, inv_dataset,
inv_fmd_host_case, inv_fmd_resource, inv_fmd_status,
inv_host_phase_1_active_slot, inv_host_phase_1_flash_hash,
inv_internal_dns, inv_last_reconciliation_dataset_result,
inv_last_reconciliation_disk_result,
Expand Down Expand Up @@ -64,6 +65,8 @@ use omicron_common::update::OmicronInstallManifestSource;
use omicron_common::zpool_name::ZpoolName;
use omicron_uuid_kinds::DatasetKind;
use omicron_uuid_kinds::DatasetUuid;
use omicron_uuid_kinds::FmdHostCaseKind;
use omicron_uuid_kinds::FmdResourceKind;
use omicron_uuid_kinds::InternalZpoolKind;
use omicron_uuid_kinds::MupdateKind;
use omicron_uuid_kinds::MupdateOverrideKind;
Expand All @@ -85,6 +88,9 @@ use omicron_uuid_kinds::{CollectionUuid, OmicronZoneUuid};
use sled_agent_types::inventory::BootImageHeader;
use sled_agent_types::inventory::BootPartitionDetails;
use sled_agent_types::inventory::ConfigReconcilerInventoryStatus;
use sled_agent_types::inventory::FmdHostCase;
use sled_agent_types::inventory::FmdInventoryResult;
use sled_agent_types::inventory::FmdResource;
use sled_agent_types::inventory::HostPhase2DesiredContents;
use sled_agent_types::inventory::HostPhase2DesiredSlots;
use sled_agent_types::inventory::ManifestBootInventory;
Expand Down Expand Up @@ -2128,6 +2134,120 @@ impl InvSvcEnabledNotOnlineParseError {
}
}

/// One row per (collection, sled) recording the outcome of FMD inventory
/// collection. `error_message` is `NULL` when the daemon was queried
/// successfully (even if it reported zero faults); set when collection
/// failed (e.g. on non-illumos sleds, or when the daemon was unreachable).
#[derive(Queryable, Clone, Debug, Selectable, Insertable)]
#[diesel(table_name = inv_fmd_status)]
pub struct InvFmdStatus {
pub inv_collection_id: DbTypedUuid<CollectionKind>,
pub sled_id: DbTypedUuid<SledKind>,
pub error_message: Option<String>,
}

impl InvFmdStatus {
pub fn new(
inv_collection_id: CollectionUuid,
sled_id: SledUuid,
result: &FmdInventoryResult,
) -> Self {
let error_message = match result {
FmdInventoryResult::Available(_) => None,
FmdInventoryResult::Error { error } => Some(error.clone()),
};
Self {
inv_collection_id: inv_collection_id.into(),
sled_id: sled_id.into(),
error_message,
}
}
}

#[derive(Queryable, Clone, Debug, Selectable, Insertable)]
#[diesel(table_name = inv_fmd_host_case)]
pub struct InvFmdHostCase {
pub inv_collection_id: DbTypedUuid<CollectionKind>,
pub sled_id: DbTypedUuid<SledKind>,
pub case_id: DbTypedUuid<FmdHostCaseKind>,
pub code: String,
pub url: String,
pub event: Option<serde_json::Value>,
}

impl InvFmdHostCase {
pub fn new(
inv_collection_id: CollectionUuid,
sled_id: SledUuid,
case: &FmdHostCase,
) -> Self {
Self {
inv_collection_id: inv_collection_id.into(),
sled_id: sled_id.into(),
case_id: case.uuid.into(),
code: case.code.clone(),
url: case.url.clone(),
event: case.event.clone(),
}
}
}

impl From<InvFmdHostCase> for FmdHostCase {
fn from(row: InvFmdHostCase) -> Self {
Self {
uuid: row.case_id.into(),
code: row.code,
url: row.url,
event: row.event,
}
}
}

#[derive(Queryable, Clone, Debug, Selectable, Insertable)]
#[diesel(table_name = inv_fmd_resource)]
pub struct InvFmdResource {
pub inv_collection_id: DbTypedUuid<CollectionKind>,
pub sled_id: DbTypedUuid<SledKind>,
pub resource_id: DbTypedUuid<FmdResourceKind>,
pub fmri: String,
pub case_id: DbTypedUuid<FmdHostCaseKind>,
pub faulty: bool,
pub unusable: bool,
pub invisible: bool,
}

impl InvFmdResource {
pub fn new(
inv_collection_id: CollectionUuid,
sled_id: SledUuid,
resource: &FmdResource,
) -> Self {
Self {
inv_collection_id: inv_collection_id.into(),
sled_id: sled_id.into(),
resource_id: resource.uuid.into(),
fmri: resource.fmri.clone(),
case_id: resource.case_id.into(),
faulty: resource.faulty,
unusable: resource.unusable,
invisible: resource.invisible,
}
}
}

impl From<InvFmdResource> for FmdResource {
fn from(row: InvFmdResource) -> Self {
Self {
uuid: row.resource_id.into(),
fmri: row.fmri,
case_id: row.case_id.into(),
faulty: row.faulty,
unusable: row.unusable,
invisible: row.invisible,
}
}
}

// See [`sled_agent_types::inventory::SvcEnabledNotOnlineState`].
impl_enum_type!(
InvSvcEnabledNotOnlineStateEnum:
Expand Down
3 changes: 2 additions & 1 deletion nexus/db-model/src/schema_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{collections::BTreeMap, sync::LazyLock};
///
/// This must be updated when you change the database schema. Refer to
/// schema/crdb/README.adoc in the root of this repository for details.
pub const SCHEMA_VERSION: Version = Version::new(253, 0, 0);
pub const SCHEMA_VERSION: Version = Version::new(254, 0, 0);

/// List of all past database schema versions, in *reverse* order
///
Expand All @@ -28,6 +28,7 @@ pub static KNOWN_VERSIONS: LazyLock<Vec<KnownVersion>> = LazyLock::new(|| {
// | leaving the first copy as an example for the next person.
// v
// KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"),
KnownVersion::new(254, "inv-fmd"),
KnownVersion::new(253, "delete-nexus-default-allow-firewall-rule"),
KnownVersion::new(252, "fm-support-bundle-and-alert-request-comments"),
KnownVersion::new(251, "fm-sitrep-next-inv-min-time-started"),
Expand Down
Loading
Loading