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 @@ -7350,30 +7350,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
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
12 changes: 12 additions & 0 deletions sled-agent/config-reconciler/src/ledger/legacy_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ fn merge_old_configs(

/// Legacy type of the ledgered zone config.
#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(test, derive(schemars::JsonSchema))]
struct OmicronZonesConfigLocal {
omicron_generation: Generation,
ledger_generation: Generation,
Expand All @@ -237,9 +238,11 @@ impl Ledgerable for OmicronZonesConfigLocal {
}

#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(test, derive(schemars::JsonSchema))]
struct OmicronZoneConfigLocal {
zone: OmicronZoneConfig,
#[serde(rename = "root")]
#[cfg_attr(test, schemars(with = "String"))]
_root: Utf8PathBuf,
}

Expand All @@ -264,6 +267,15 @@ pub(super) mod tests {
const MERGED_CONFIG_PATH: &str =
"test-data/expectorate/merged-sled-config.json";

#[test]
fn test_old_config_schema() {
let schema = schemars::schema_for!(OmicronZonesConfigLocal);
expectorate::assert_contents(
"../../schema/all-zones-requests.json",
&serde_json::to_string_pretty(&schema).unwrap(),
);
}

#[test]
fn test_merge_old_configs() {
let disks: OmicronPhysicalDisksConfig = {
Expand Down
14 changes: 12 additions & 2 deletions sled-agent/config-reconciler/src/reconciler_task/zones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,16 @@ impl OmicronZone {
)
.await
}
ZoneState::FailedToStart(_) => {
// With these errors, we never even tried to start the zone, so
// there's no cleanup required: we can just return.
ZoneState::FailedToStart(ZoneStartError::TimeNotSynchronized)
| ZoneState::FailedToStart(ZoneStartError::CheckZoneExists(_))
| ZoneState::FailedToStart(ZoneStartError::DatasetDependency(_)) => {
Ok(())
}
ZoneState::FailedToStart(ZoneStartError::SledAgentStartFailed(
err,
)) => {
// TODO-correctness What do we need to do to try to shut down a
// zone that we tried to start? We need fine-grained status of
// what startup things succeeded that need to be cleaned up. For
Expand All @@ -639,7 +648,8 @@ impl OmicronZone {
log,
"need to shut down zone that failed to start, but this \
is currently unimplemented: assuming no cleanup work \
required"
required";
"start-err" => InlineErrorChain::new(err.as_ref()),
);
Ok(())
}
Expand Down
Loading
Loading