Skip to content

Commit 399bf68

Browse files
authored
[sled-agent-config-reconciler] Minor cleanup (#8266)
1 parent dabe75e commit 399bf68

File tree

2 files changed

+34
-26
lines changed
  • dev-tools/omdb/src/bin/omdb
  • sled-agent/config-reconciler/src/reconciler_task

2 files changed

+34
-26
lines changed

dev-tools/omdb/src/bin/omdb/db.rs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7350,30 +7350,28 @@ fn inv_collection_print_sleds(collection: &Collection) {
73507350
"LAST RECONCILED CONFIG",
73517351
&last_reconciliation.last_reconciled_config,
73527352
);
7353-
let disk_errs = collect_config_reconciler_errors(
7354-
&last_reconciliation.external_disks,
7355-
);
7356-
let dataset_errs = collect_config_reconciler_errors(
7357-
&last_reconciliation.datasets,
7358-
);
7359-
let zone_errs = collect_config_reconciler_errors(
7360-
&last_reconciliation.zones,
7361-
);
7362-
for (label, errs) in [
7363-
("disk", disk_errs),
7364-
("dataset", dataset_errs),
7365-
("zone", zone_errs),
7366-
] {
7367-
if errs.is_empty() {
7368-
println!(" all {label}s reconciled successfully");
7369-
} else {
7370-
println!(
7371-
" {} {label} reconciliation errors:",
7372-
errs.len()
7373-
);
7374-
for err in errs {
7375-
println!(" {err}");
7376-
}
7353+
}
7354+
let disk_errs = collect_config_reconciler_errors(
7355+
&last_reconciliation.external_disks,
7356+
);
7357+
let dataset_errs =
7358+
collect_config_reconciler_errors(&last_reconciliation.datasets);
7359+
let zone_errs =
7360+
collect_config_reconciler_errors(&last_reconciliation.zones);
7361+
for (label, errs) in [
7362+
("disk", disk_errs),
7363+
("dataset", dataset_errs),
7364+
("zone", zone_errs),
7365+
] {
7366+
if errs.is_empty() {
7367+
println!(" all {label}s reconciled successfully");
7368+
} else {
7369+
println!(
7370+
" {} {label} reconciliation errors:",
7371+
errs.len()
7372+
);
7373+
for err in errs {
7374+
println!(" {err}");
73777375
}
73787376
}
73797377
}

sled-agent/config-reconciler/src/reconciler_task/zones.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,16 @@ impl OmicronZone {
630630
)
631631
.await
632632
}
633-
ZoneState::FailedToStart(_) => {
633+
// With these errors, we never even tried to start the zone, so
634+
// there's no cleanup required: we can just return.
635+
ZoneState::FailedToStart(ZoneStartError::TimeNotSynchronized)
636+
| ZoneState::FailedToStart(ZoneStartError::CheckZoneExists(_))
637+
| ZoneState::FailedToStart(ZoneStartError::DatasetDependency(_)) => {
638+
Ok(())
639+
}
640+
ZoneState::FailedToStart(ZoneStartError::SledAgentStartFailed(
641+
err,
642+
)) => {
634643
// TODO-correctness What do we need to do to try to shut down a
635644
// zone that we tried to start? We need fine-grained status of
636645
// what startup things succeeded that need to be cleaned up. For
@@ -639,7 +648,8 @@ impl OmicronZone {
639648
log,
640649
"need to shut down zone that failed to start, but this \
641650
is currently unimplemented: assuming no cleanup work \
642-
required"
651+
required";
652+
"start-err" => InlineErrorChain::new(err.as_ref()),
643653
);
644654
Ok(())
645655
}

0 commit comments

Comments
 (0)