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

Pull support-bundle/queries into a standalone crate #7193

Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 11 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ members = [
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-diagnostics",
"sled-hardware",
"sled-hardware/types",
"sled-storage",
Expand Down Expand Up @@ -240,6 +241,7 @@ default-members = [
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-diagnostics",
"sled-hardware",
"sled-hardware/types",
"sled-storage",
Expand Down Expand Up @@ -596,6 +598,7 @@ sled = "=0.34.7"
sled-agent-api = { path = "sled-agent/api" }
sled-agent-client = { path = "clients/sled-agent-client" }
sled-agent-types = { path = "sled-agent/types" }
sled-diagnostics = { path = "sled-diagnostics" }
sled-hardware = { path = "sled-hardware" }
sled-hardware-types = { path = "sled-hardware/types" }
sled-storage = { path = "sled-storage" }
Expand Down
1 change: 1 addition & 0 deletions sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ sha3.workspace = true
sled-agent-api.workspace = true
sled-agent-client.workspace = true
sled-agent-types.workspace = true
sled-diagnostics.workspace = true
sled-hardware.workspace = true
sled-hardware-types.workspace = true
sled-storage.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use super::sled_agent::SledAgent;
use crate::sled_agent::Error as SledAgentError;
use crate::support_bundle::queries::SupportBundleCommandHttpOutput;
use crate::zone_bundle::BundleError;
use bootstore::schemes::v0::NetworkConfig;
use camino::Utf8PathBuf;
Expand Down Expand Up @@ -53,6 +52,7 @@ use sled_agent_types::zone_bundle::{
BundleUtilization, CleanupContext, CleanupCount, CleanupPeriod,
StorageLimit, ZoneBundleId, ZoneBundleMetadata,
};
use sled_diagnostics::SledDiagnosticsCommandHttpOutput;
use std::collections::BTreeMap;

type SledApiDescription = ApiDescription<SledAgent>;
Expand Down
17 changes: 7 additions & 10 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ use crate::params::OmicronZoneTypeExt;
use crate::probe_manager::ProbeManager;
use crate::services::{self, ServiceManager};
use crate::storage_monitor::StorageMonitorHandle;
use crate::support_bundle::queries::{
dladm_info, ipadm_info, zoneadm_info, SupportBundleCmdError,
SupportBundleCmdOutput,
};
use crate::support_bundle::storage::SupportBundleManager;
use crate::updates::{ConfigUpdates, UpdateManager};
use crate::vmm_reservoir::{ReservoirMode, VmmReservoirManager};
Expand Down Expand Up @@ -76,6 +72,7 @@ use sled_agent_types::zone_bundle::{
BundleUtilization, CleanupContext, CleanupCount, CleanupPeriod,
PriorityOrder, StorageLimit, ZoneBundleMetadata,
};
use sled_diagnostics::{SledDiagnosticsCmdError, SledDiagnosticsCmdOutput};
use sled_hardware::{underlay, HardwareManager};
use sled_hardware_types::underlay::BootstrapInterface;
use sled_hardware_types::Baseboard;
Expand Down Expand Up @@ -1367,20 +1364,20 @@ impl SledAgent {

pub(crate) async fn support_zoneadm_info(
&self,
) -> Result<SupportBundleCmdOutput, SupportBundleCmdError> {
zoneadm_info().await
) -> Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError> {
sled_diagnostics::zoneadm_info().await
}

pub(crate) async fn support_ipadm_info(
&self,
) -> Vec<Result<SupportBundleCmdOutput, SupportBundleCmdError>> {
ipadm_info().await
) -> Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>> {
sled_diagnostics::ipadm_info().await
}

pub(crate) async fn support_dladm_info(
&self,
) -> Vec<Result<SupportBundleCmdOutput, SupportBundleCmdError>> {
dladm_info().await
) -> Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>> {
sled_diagnostics::dladm_info().await
}
}

Expand Down
1 change: 0 additions & 1 deletion sled-agent/src/support_bundle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

pub mod queries;
pub mod storage;
1 change: 1 addition & 0 deletions sled-diagnostics/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
13 changes: 13 additions & 0 deletions sled-diagnostics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "sled-diagnostics"
version = "0.1.0"
edition = "2021"

[lints]
workspace = true

[dependencies]
futures.workspace = true
omicron-workspace-hack.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
52 changes: 52 additions & 0 deletions sled-diagnostics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Diagnostics for an Oxide sled that exposes common support commands.

use futures::{stream::FuturesUnordered, StreamExt};

mod queries;
pub use crate::queries::{
SledDiagnosticsCmdError, SledDiagnosticsCmdOutput,
SledDiagnosticsCommandHttpOutput,
};
use queries::*;

/// List all zones on a sled.
pub async fn zoneadm_info(
) -> Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError> {
execute_command_with_timeout(zoneadm_list(), DEFAULT_TIMEOUT).await
}

/// Retrieve various `ipadm` command output for the system.
pub async fn ipadm_info(
) -> Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>> {
[ipadm_show_interface(), ipadm_show_addr(), ipadm_show_prop()]
.into_iter()
.map(|c| async move {
execute_command_with_timeout(c, DEFAULT_TIMEOUT).await
})
.collect::<FuturesUnordered<_>>()
.collect::<Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>>>()
.await
}

/// Retrieve various `dladm` command output for the system.
pub async fn dladm_info(
) -> Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>> {
[
dladm_show_phys(),
dladm_show_ether(),
dladm_show_link(),
dladm_show_vnic(),
dladm_show_linkprop(),
]
.into_iter()
.map(|c| async move {
execute_command_with_timeout(c, DEFAULT_TIMEOUT).await
})
.collect::<FuturesUnordered<_>>()
.collect::<Vec<Result<SledDiagnosticsCmdOutput, SledDiagnosticsCmdError>>>()
.await
}
Loading
Loading