Skip to content

Commit

Permalink
omdb support for showing devices visible to MGS (#4162)
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco authored Oct 6, 2023
1 parent c76ca69 commit 230637a
Show file tree
Hide file tree
Showing 11 changed files with 697 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

16 changes: 15 additions & 1 deletion clients/gateway-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ progenitor::generate_api!(
}),
derives = [schemars::JsonSchema],
patch = {
SpIdentifier = { derives = [Copy, PartialEq, Hash, Eq, PartialOrd, Ord, Serialize, Deserialize] },
SpIdentifier = { derives = [Copy, PartialEq, Hash, Eq, Serialize, Deserialize] },
SpIgnition = { derives = [PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize] },
SpIgnitionSystemType = { derives = [Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize] },
SpState = { derives = [ PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize] },
Expand All @@ -59,3 +59,17 @@ progenitor::generate_api!(
HostPhase2RecoveryImageId = { derives = [ PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize] },
},
);

// Override the impl of Ord for SpIdentifier because the default one orders the
// fields in a different order than people are likely to want.
impl Ord for crate::types::SpIdentifier {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.type_.cmp(&other.type_).then(self.slot.cmp(&other.slot))
}
}

impl PartialOrd for crate::types::SpIdentifier {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
5 changes: 4 additions & 1 deletion dev-tools/omdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ chrono.workspace = true
clap.workspace = true
diesel.workspace = true
dropshot.workspace = true
futures.workspace = true
gateway-client.workspace = true
gateway-messages.workspace = true
gateway-test-utils.workspace = true
humantime.workspace = true
internal-dns.workspace = true
futures.workspace = true
nexus-client.workspace = true
nexus-db-model.workspace = true
nexus-db-queries.workspace = true
Expand Down
4 changes: 4 additions & 0 deletions dev-tools/omdb/src/bin/omdb/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use std::net::SocketAddr;
use std::net::SocketAddrV6;

mod db;
mod mgs;
mod nexus;
mod oximeter;
mod sled_agent;
Expand All @@ -57,6 +58,7 @@ async fn main() -> Result<(), anyhow::Error> {

match &args.command {
OmdbCommands::Db(db) => db.run_cmd(&args, &log).await,
OmdbCommands::Mgs(mgs) => mgs.run_cmd(&args, &log).await,
OmdbCommands::Nexus(nexus) => nexus.run_cmd(&args, &log).await,
OmdbCommands::Oximeter(oximeter) => oximeter.run_cmd(&log).await,
OmdbCommands::SledAgent(sled) => sled.run_cmd(&args, &log).await,
Expand Down Expand Up @@ -155,6 +157,8 @@ impl Omdb {
enum OmdbCommands {
/// Query the control plane database (CockroachDB)
Db(db::DbArgs),
/// Debug a specific Management Gateway Service instance
Mgs(mgs::MgsArgs),
/// Debug a specific Nexus instance
Nexus(nexus::NexusArgs),
/// Query oximeter collector state
Expand Down
Loading

0 comments on commit 230637a

Please sign in to comment.