diff --git a/crates/ctl/src/cli/host/dmesg.rs b/crates/ctl/src/cli/host/dmesg.rs new file mode 100644 index 0000000..2dec241 --- /dev/null +++ b/crates/ctl/src/cli/host/dmesg.rs @@ -0,0 +1,24 @@ +use anyhow::Result; +use clap::Parser; +use krata::v1::control::{ + control_service_client::ControlServiceClient, ReadHypervisorConsoleRingRequest, +}; + +use tonic::{transport::Channel, Request}; + +#[derive(Parser)] +#[command(about = "Display hypervisor diagnostic messages")] +pub struct HostHypervisorMessagesCommand { +} + +impl HostHypervisorMessagesCommand { + pub async fn run(self, mut client: ControlServiceClient) -> Result<()> { + let response = client + .read_hypervisor_console_ring(Request::new(ReadHypervisorConsoleRingRequest { clear: false })) + .await? + .into_inner(); + + print!("{}", response.data); + Ok(()) + } +} diff --git a/crates/ctl/src/cli/host/mod.rs b/crates/ctl/src/cli/host/mod.rs index 9c08dbe..32ccfb7 100644 --- a/crates/ctl/src/cli/host/mod.rs +++ b/crates/ctl/src/cli/host/mod.rs @@ -8,10 +8,12 @@ use krata::v1::control::control_service_client::ControlServiceClient; use crate::cli::host::cpu_topology::HostCpuTopologyCommand; use crate::cli::host::identify::HostStatusCommand; use crate::cli::host::idm_snoop::HostIdmSnoopCommand; +use crate::cli::host::dmesg::HostHypervisorMessagesCommand; pub mod cpu_topology; pub mod identify; pub mod idm_snoop; +pub mod dmesg; #[derive(Parser)] #[command(about = "Manage the host of the isolation engine")] @@ -35,6 +37,7 @@ pub enum HostCommands { CpuTopology(HostCpuTopologyCommand), Status(HostStatusCommand), IdmSnoop(HostIdmSnoopCommand), + HypervisorMessages(HostHypervisorMessagesCommand), } impl HostCommands { @@ -49,6 +52,8 @@ impl HostCommands { HostCommands::Status(status) => status.run(client).await, HostCommands::IdmSnoop(snoop) => snoop.run(client, events).await, + + HostCommands::HypervisorMessages(hvdmesg) => hvdmesg.run(client).await, } } }