diff --git a/omdb/src/bin/omdb/main.rs b/omdb/src/bin/omdb/main.rs index eaf3a891f9..d0c47f8e2a 100644 --- a/omdb/src/bin/omdb/main.rs +++ b/omdb/src/bin/omdb/main.rs @@ -25,7 +25,7 @@ use clap::Subcommand; mod db; mod nexus; -mod sled; +mod sled_agent; #[tokio::main] async fn main() -> Result<(), anyhow::Error> { @@ -38,7 +38,7 @@ async fn main() -> Result<(), anyhow::Error> { match args.command { OmdbCommands::Db(db) => db.run_cmd(&log).await, OmdbCommands::Nexus(nexus) => nexus.run_cmd(&log).await, - OmdbCommands::Sled(sled) => sled.run_cmd(&log).await, + OmdbCommands::SledAgent(sled) => sled.run_cmd(&log).await, } } @@ -70,7 +70,7 @@ enum OmdbCommands { /// Debug a specific Nexus instance Nexus(nexus::NexusArgs), /// Debug a specific Sled - Sled(sled::SledArgs), + SledAgent(sled_agent::SledAgentArgs), } fn parse_dropshot_log_level( diff --git a/omdb/src/bin/omdb/sled.rs b/omdb/src/bin/omdb/sled_agent.rs similarity index 76% rename from omdb/src/bin/omdb/sled.rs rename to omdb/src/bin/omdb/sled_agent.rs index 394ba481de..09f34936ca 100644 --- a/omdb/src/bin/omdb/sled.rs +++ b/omdb/src/bin/omdb/sled_agent.rs @@ -11,18 +11,18 @@ use clap::Subcommand; /// Arguments to the "omdb sled" subcommand #[derive(Debug, Args)] -pub struct SledArgs { +pub struct SledAgentArgs { /// URL of the Sled internal API - #[clap(long, env("OMDB_SLED_URL"))] - sled_url: Option, + #[clap(long, env("OMDB_SLED_AGENT_URL"))] + sled_agent_url: Option, #[command(subcommand)] - command: SledCommands, + command: SledAgentCommands, } /// Subcommands for the "omdb sled" subcommand #[derive(Debug, Subcommand)] -enum SledCommands { +enum SledAgentCommands { /// print information about zones #[clap(subcommand)] Zones(ZoneCommands), @@ -34,17 +34,17 @@ enum SledCommands { #[derive(Debug, Subcommand)] enum ZoneCommands { - /// Print list of all zones + /// Print list of all running control plane zones List, } #[derive(Debug, Subcommand)] enum ZpoolCommands { - /// Print list of all zpools + /// Print list of all zpools managed by the sled agent List, } -impl SledArgs { +impl SledAgentArgs { /// Run a `omdb sled` subcommand. pub async fn run_cmd( &self, @@ -52,19 +52,20 @@ impl SledArgs { ) -> Result<(), anyhow::Error> { // This is a little goofy. The sled URL is required, but can come // from the environment, in which case it won't be on the command line. - let Some(sled_url) = &self.sled_url else { + let Some(sled_agent_url) = &self.sled_agent_url else { bail!( - "sled URL must be specified with --sled-url or \ - OMDB_SLED_URL" + "sled URL must be specified with --sled-agent-url or \ + OMDB_SLED_AGENT_URL" ); }; - let client = sled_agent_client::Client::new(sled_url, log.clone()); + let client = + sled_agent_client::Client::new(sled_agent_url, log.clone()); match &self.command { - SledCommands::Zones(ZoneCommands::List) => { + SledAgentCommands::Zones(ZoneCommands::List) => { cmd_zones_list(&client).await } - SledCommands::Zpools(ZpoolCommands::List) => { + SledAgentCommands::Zpools(ZpoolCommands::List) => { cmd_zpools_list(&client).await } } diff --git a/omdb/tests/usage_errors.out b/omdb/tests/usage_errors.out index 860c0efe21..b381ab46c1 100644 --- a/omdb/tests/usage_errors.out +++ b/omdb/tests/usage_errors.out @@ -9,9 +9,10 @@ Omicron debugger (unstable) Usage: omdb [OPTIONS] Commands: - db Query the control plane database (CockroachDB) - nexus Debug a specific Nexus instance - help Print this message or the help of the given subcommand(s) + db Query the control plane database (CockroachDB) + nexus Debug a specific Nexus instance + sled-agent Debug a specific Sled + help Print this message or the help of the given subcommand(s) Options: --log-level log level filter [env: LOG_LEVEL=] [default: warn] @@ -29,9 +30,10 @@ using internal APIs. This is a prototype. The commands and output are unstable Usage: omdb [OPTIONS] Commands: - db Query the control plane database (CockroachDB) - nexus Debug a specific Nexus instance - help Print this message or the help of the given subcommand(s) + db Query the control plane database (CockroachDB) + nexus Debug a specific Nexus instance + sled-agent Debug a specific Sled + help Print this message or the help of the given subcommand(s) Options: --log-level