Skip to content

Commit

Permalink
[spr] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
papertigers committed Dec 2, 2024
1 parent 41d7c9b commit 1c04227
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 84 deletions.
10 changes: 10 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
9 changes: 9 additions & 0 deletions sled-diagnostics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "sled-diagnostics"
version = "0.1.0"
edition = "2021"

[dependencies]
futures.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

0 comments on commit 1c04227

Please sign in to comment.