Skip to content
Merged
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 22 additions & 24 deletions dev-tools/omdb/src/bin/omdb/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7351,30 +7351,28 @@ fn inv_collection_print_sleds(collection: &Collection) {
"LAST RECONCILED CONFIG",
&last_reconciliation.last_reconciled_config,
);
let disk_errs = collect_config_reconciler_errors(
&last_reconciliation.external_disks,
);
let dataset_errs = collect_config_reconciler_errors(
&last_reconciliation.datasets,
);
let zone_errs = collect_config_reconciler_errors(
&last_reconciliation.zones,
);
for (label, errs) in [
("disk", disk_errs),
("dataset", dataset_errs),
("zone", zone_errs),
] {
if errs.is_empty() {
println!(" all {label}s reconciled successfully");
} else {
println!(
" {} {label} reconciliation errors:",
errs.len()
);
for err in errs {
println!(" {err}");
}
}
let disk_errs = collect_config_reconciler_errors(
&last_reconciliation.external_disks,
);
let dataset_errs =
collect_config_reconciler_errors(&last_reconciliation.datasets);
let zone_errs =
collect_config_reconciler_errors(&last_reconciliation.zones);
for (label, errs) in [
("disk", disk_errs),
("dataset", dataset_errs),
("zone", zone_errs),
] {
if errs.is_empty() {
println!(" all {label}s reconciled successfully");
} else {
println!(
" {} {label} reconciliation errors:",
errs.len()
);
for err in errs {
println!(" {err}");
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions nexus-sled-agent-shared/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use chrono::{DateTime, Utc};
use daft::Diffable;
use id_map::IdMap;
use id_map::IdMappable;
use omicron_common::disk::{DatasetKind, DatasetName};
use omicron_common::ledger::Ledgerable;
use omicron_common::{
api::{
Expand Down Expand Up @@ -327,6 +328,10 @@ impl OmicronZoneConfig {
Some(self.id),
)
}

pub fn dataset_name(&self) -> Option<DatasetName> {
self.zone_type.dataset_name()
}
}

/// Describes a persistent ZFS dataset associated with an Omicron zone
Expand Down Expand Up @@ -613,6 +618,41 @@ impl OmicronZoneType {
| OmicronZoneType::Oximeter { .. } => None,
}
}

/// If this kind of zone has an associated dataset, return the dataset's
/// name. Otherwise, return `None`.
pub fn dataset_name(&self) -> Option<DatasetName> {
let (dataset, dataset_kind) = match self {
OmicronZoneType::BoundaryNtp { .. }
| OmicronZoneType::InternalNtp { .. }
| OmicronZoneType::Nexus { .. }
| OmicronZoneType::Oximeter { .. }
| OmicronZoneType::CruciblePantry { .. } => None,
OmicronZoneType::Clickhouse { dataset, .. } => {
Some((dataset, DatasetKind::Clickhouse))
}
OmicronZoneType::ClickhouseKeeper { dataset, .. } => {
Some((dataset, DatasetKind::ClickhouseKeeper))
}
OmicronZoneType::ClickhouseServer { dataset, .. } => {
Some((dataset, DatasetKind::ClickhouseServer))
}
OmicronZoneType::CockroachDb { dataset, .. } => {
Some((dataset, DatasetKind::Cockroach))
}
OmicronZoneType::Crucible { dataset, .. } => {
Some((dataset, DatasetKind::Crucible))
}
OmicronZoneType::ExternalDns { dataset, .. } => {
Some((dataset, DatasetKind::ExternalDns))
}
OmicronZoneType::InternalDns { dataset, .. } => {
Some((dataset, DatasetKind::InternalDns))
}
}?;

Some(DatasetName::new(dataset.pool_name, dataset_kind))
}
}

/// Like [`OmicronZoneType`], but without any associated data.
Expand Down
17 changes: 3 additions & 14 deletions schema/all-zones-requests.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OmicronZonesConfigLocal",
"description": "Combines the Nexus-provided `OmicronZonesConfig` (which describes what Nexus wants for all of its zones) with the locally-determined configuration for these zones.",
"description": "Legacy type of the ledgered zone config.",
"type": "object",
"required": [
"ledger_generation",
Expand All @@ -10,20 +10,10 @@
],
"properties": {
"ledger_generation": {
"description": "ledger-managed generation number\n\nThis generation is managed by the ledger facility itself. It's bumped whenever we write a new ledger. In practice, we don't currently have any reason to bump this _for a given Omicron generation_ so it's somewhat redundant. In principle, if we needed to modify the ledgered configuration due to some event that doesn't change the Omicron config (e.g., if we wanted to move the root filesystem to a different path), we could do that by bumping this generation.",
"allOf": [
{
"$ref": "#/definitions/Generation"
}
]
"$ref": "#/definitions/Generation"
},
"omicron_generation": {
"description": "generation of the Omicron-provided part of the configuration\n\nThis generation number is outside of Sled Agent's control. We store exactly what we were given and use this number to decide when to fail requests to establish an outdated configuration.\n\nYou can think of this as a major version number, with `ledger_generation` being a minor version number. See `is_newer_than()`.",
"allOf": [
{
"$ref": "#/definitions/Generation"
}
]
"$ref": "#/definitions/Generation"
},
"zones": {
"type": "array",
Expand Down Expand Up @@ -269,7 +259,6 @@
}
},
"OmicronZoneConfigLocal": {
"description": "Combines the Nexus-provided `OmicronZoneConfig` (which describes what Nexus wants for this zone) with any locally-determined configuration (like the path to the root filesystem)",
"type": "object",
"required": [
"root",
Expand Down
1 change: 1 addition & 0 deletions sled-agent/config-reconciler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ expectorate.workspace = true
illumos-utils = { workspace = true, features = ["testing"] }
omicron-test-utils.workspace = true
proptest.workspace = true
schemars.workspace = true
scopeguard.workspace = true
serde_json.workspace = true
sled-storage = { workspace = true, features = ["testing"] }
Expand Down
Loading
Loading