feature(hypervisor-dmesg): ctl: add host hypervisor-messages command to get hypervisor messages

This commit is contained in:
Ariadne Conill 2024-08-18 16:53:20 -07:00
parent b33ce7c874
commit 3255136b04
No known key found for this signature in database
2 changed files with 29 additions and 0 deletions

View File

@ -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<Channel>) -> Result<()> {
let response = client
.read_hypervisor_console_ring(Request::new(ReadHypervisorConsoleRingRequest { clear: false }))
.await?
.into_inner();
print!("{}", response.data);
Ok(())
}
}

View File

@ -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,
}
}
}