Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[omdb] Parse Decommissioned Disk Cleaner task output #7364

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
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
99 changes: 99 additions & 0 deletions dev-tools/omdb/src/bin/omdb/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ use nexus_types::internal_api::background::RegionSnapshotReplacementFinishStatus
use nexus_types::internal_api::background::RegionSnapshotReplacementGarbageCollectStatus;
use nexus_types::internal_api::background::RegionSnapshotReplacementStartStatus;
use nexus_types::internal_api::background::RegionSnapshotReplacementStepStatus;
use nexus_types::internal_api::background::SupportBundleCleanupReport;
use nexus_types::internal_api::background::SupportBundleCollectionReport;
use nexus_types::inventory::BaseboardId;
use omicron_uuid_kinds::BlueprintUuid;
use omicron_uuid_kinds::CollectionUuid;
Expand Down Expand Up @@ -889,6 +891,9 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) {
"blueprint_loader" => {
print_task_blueprint_loader(details);
}
"decommissioned_disk_cleaner" => {
print_task_decommissioned_disk_cleaner(details);
}
"dns_config_external" | "dns_config_internal" => {
print_task_dns_config(details);
}
Expand Down Expand Up @@ -943,6 +948,9 @@ fn print_task_details(bgtask: &BackgroundTask, details: &serde_json::Value) {
"service_firewall_rule_propagation" => {
print_task_service_firewall_rule_propagation(details);
}
"support_bundle_collector" => {
print_task_support_bundle_collector(details);
}
_ => {
println!(
"warning: unknown background task: {:?} \
Expand Down Expand Up @@ -1107,6 +1115,37 @@ fn print_task_blueprint_loader(details: &serde_json::Value) {
}
}

fn print_task_decommissioned_disk_cleaner(details: &serde_json::Value) {
#[derive(Deserialize)]
struct ActivationResult {
error: Option<String>,
found: usize,
not_ready_to_be_deleted: usize,
deleted: usize,
error_count: usize,
}
match serde_json::from_value::<ActivationResult>(details.clone()) {
Err(error) => eprintln!(
"warning: failed to interpret task details: {:?}: {:?}",
error, details
),
Ok(ActivationResult {
error,
found,
not_ready_to_be_deleted,
deleted,
error_count,
}) => {
println!(" Decommissioned Disk Cleaner");
println!(" Last error: {error:?}");
println!(" Zpools found: {found}");
println!(" Zpools deleted from db: {deleted}");
println!(" Zpools not ready to be deleted from db: {not_ready_to_be_deleted}");
println!(" Zpools which failed to delete: {error_count}");
}
}
}

fn print_task_dns_config(details: &serde_json::Value) {
// The "dns_config" tasks emit the generation number of the config that
// they read.
Expand Down Expand Up @@ -2024,6 +2063,66 @@ fn print_task_service_firewall_rule_propagation(details: &serde_json::Value) {
};
}

fn print_task_support_bundle_collector(details: &serde_json::Value) {
#[derive(Deserialize)]
struct SupportBundleCollectionStatus {
cleanup_report: Option<SupportBundleCleanupReport>,
cleanup_err: Option<String>,
collection_report: Option<SupportBundleCollectionReport>,
collection_err: Option<String>,
}

match serde_json::from_value::<SupportBundleCollectionStatus>(
details.clone(),
) {
Err(error) => eprintln!(
"warning: failed to interpret task details: {:?}: {:?}",
error, details
),
Ok(SupportBundleCollectionStatus {
cleanup_report,
cleanup_err,
collection_report,
collection_err,
}) => {
if let Some(cleanup_err) = cleanup_err {
println!(" failed to perform cleanup: {cleanup_err}");
}
if let Some(SupportBundleCleanupReport {
sled_bundles_deleted_ok,
sled_bundles_deleted_not_found,
sled_bundles_delete_failed,
db_destroying_bundles_removed,
db_failing_bundles_updated,
}) = cleanup_report
{
println!(" Support Bundle Cleanup Report:");
println!(" Bundles deleted from sleds: {sled_bundles_deleted_ok}");
println!(" Bundles not found on sleds: {sled_bundles_deleted_not_found}");
println!(" Bundles delete failed on sleds: {sled_bundles_delete_failed}");
println!(" Bundles deleted from database: {db_destroying_bundles_removed}");
println!(" Bundles marked failed in database: {db_failing_bundles_updated}");
}

if let Some(collection_err) = collection_err {
println!(" failed to perform collection: {collection_err}");
}

if let Some(SupportBundleCollectionReport {
bundle,
listed_in_service_sleds,
activated_in_db_ok,
}) = collection_report
{
println!(" Support Bundle Collection Report:");
println!(" Bundle ID: {bundle}");
println!(" Bundle was able to list in-service sleds: {listed_in_service_sleds}");
println!(" Bundle was activated in the database: {activated_in_db_ok}");
}
}
}
}

/// Summarizes an `ActivationReason`
fn reason_str(reason: &ActivationReason) -> &'static str {
match reason {
Expand Down
28 changes: 24 additions & 4 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,12 @@ task: "decommissioned_disk_cleaner"
currently executing: no
last completed activation: <REDACTED ITERATIONS>, triggered by a periodic timer firing
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
warning: unknown background task: "decommissioned_disk_cleaner" (don't know how to interpret details: Object {"deleted": Number(0), "error": Null, "error_count": Number(0), "found": Number(0), "not_ready_to_be_deleted": Number(0)})
Decommissioned Disk Cleaner
Last error: None
Zpools found: 0
Zpools deleted from db: 0
Zpools not ready to be deleted from db: 0
Zpools which failed to delete: 0

task: "external_endpoints"
configured period: every <REDACTED_DURATION>m
Expand Down Expand Up @@ -715,7 +720,12 @@ task: "support_bundle_collector"
currently executing: no
last completed activation: <REDACTED ITERATIONS>, triggered by a periodic timer firing
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
warning: unknown background task: "support_bundle_collector" (don't know how to interpret details: Object {"cleanup_err": Null, "cleanup_report": Object {"db_destroying_bundles_removed": Number(0), "db_failing_bundles_updated": Number(0), "sled_bundles_delete_failed": Number(0), "sled_bundles_deleted_not_found": Number(0), "sled_bundles_deleted_ok": Number(0)}, "collection_err": Null, "collection_report": Null})
Support Bundle Cleanup Report:
Bundles deleted from sleds: 0
Bundles not found on sleds: 0
Bundles delete failed on sleds: 0
Bundles deleted from database: 0
Bundles marked failed in database: 0

task: "switch_port_config_manager"
configured period: every <REDACTED_DURATION>s
Expand Down Expand Up @@ -982,7 +992,12 @@ task: "decommissioned_disk_cleaner"
currently executing: no
last completed activation: <REDACTED ITERATIONS>, triggered by a periodic timer firing
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
warning: unknown background task: "decommissioned_disk_cleaner" (don't know how to interpret details: Object {"deleted": Number(0), "error": Null, "error_count": Number(0), "found": Number(0), "not_ready_to_be_deleted": Number(0)})
Decommissioned Disk Cleaner
Last error: None
Zpools found: 0
Zpools deleted from db: 0
Zpools not ready to be deleted from db: 0
Zpools which failed to delete: 0

task: "external_endpoints"
configured period: every <REDACTED_DURATION>m
Expand Down Expand Up @@ -1174,7 +1189,12 @@ task: "support_bundle_collector"
currently executing: no
last completed activation: <REDACTED ITERATIONS>, triggered by a periodic timer firing
started at <REDACTED_TIMESTAMP> (<REDACTED DURATION>s ago) and ran for <REDACTED DURATION>ms
warning: unknown background task: "support_bundle_collector" (don't know how to interpret details: Object {"cleanup_err": Null, "cleanup_report": Object {"db_destroying_bundles_removed": Number(0), "db_failing_bundles_updated": Number(0), "sled_bundles_delete_failed": Number(0), "sled_bundles_deleted_not_found": Number(0), "sled_bundles_deleted_ok": Number(0)}, "collection_err": Null, "collection_report": Null})
Support Bundle Cleanup Report:
Bundles deleted from sleds: 0
Bundles not found on sleds: 0
Bundles delete failed on sleds: 0
Bundles deleted from database: 0
Bundles marked failed in database: 0

task: "switch_port_config_manager"
configured period: every <REDACTED_DURATION>s
Expand Down
Loading