feature(zone): kernel command line control on launch (#351)

This commit is contained in:
Alex Zenla
2024-08-21 13:51:09 -07:00
committed by GitHub
parent 1123a1a50a
commit 151b43eeec
13 changed files with 79 additions and 35 deletions

View File

@ -7,9 +7,8 @@ use krata::v1::control::{
use tonic::{transport::Channel, Request};
#[derive(Parser)]
#[command(about = "Display hypervisor diagnostic messages")]
pub struct HostHvConsoleCommand {
}
#[command(about = "Display hypervisor console output")]
pub struct HostHvConsoleCommand {}
impl HostHvConsoleCommand {
pub async fn run(self, mut client: ControlServiceClient<Channel>) -> Result<()> {

View File

@ -6,14 +6,14 @@ use krata::events::EventStream;
use krata::v1::control::control_service_client::ControlServiceClient;
use crate::cli::host::cpu_topology::HostCpuTopologyCommand;
use crate::cli::host::hv_console::HostHvConsoleCommand;
use crate::cli::host::identify::HostStatusCommand;
use crate::cli::host::idm_snoop::HostIdmSnoopCommand;
use crate::cli::host::hv_console::HostHvConsoleCommand;
pub mod cpu_topology;
pub mod hv_console;
pub mod identify;
pub mod idm_snoop;
pub mod hv_console;
#[derive(Parser)]
#[command(about = "Manage the host of the isolation engine")]

View File

@ -31,6 +31,7 @@ pub struct ControlCommand {
command: ControlCommands,
}
#[allow(clippy::large_enum_variant)]
#[derive(Parser)]
pub enum ControlCommands {
Zone(ZoneCommand),
@ -48,7 +49,11 @@ impl ControlCommand {
}
impl ControlCommands {
pub async fn run(self, client: ControlServiceClient<Channel>, events: EventStream) -> Result<()> {
pub async fn run(
self,
client: ControlServiceClient<Channel>,
events: EventStream,
) -> Result<()> {
match self {
ControlCommands::Zone(zone) => zone.run(client, events).await,

View File

@ -6,8 +6,8 @@ use krata::{
events::EventStream,
v1::{
common::{
zone_image_spec::Image, OciImageFormat, ZoneImageSpec, ZoneOciImageSpec,
ZoneResourceSpec, ZoneSpec, ZoneSpecDevice, ZoneState, ZoneTaskSpec,
zone_image_spec::Image, OciImageFormat, ZoneImageSpec, ZoneKernelOptionsSpec,
ZoneOciImageSpec, ZoneResourceSpec, ZoneSpec, ZoneSpecDevice, ZoneState, ZoneTaskSpec,
ZoneTaskSpecEnvVar,
},
control::{
@ -91,6 +91,10 @@ pub struct ZoneLaunchCommand {
initrd: Option<String>,
#[arg(short = 'w', long, help = "Working directory")]
working_directory: Option<String>,
#[arg(long, help = "Enable verbose logging on the kernel")]
kernel_verbose: bool,
#[arg(long, help = "Additional kernel cmdline options")]
kernel_cmdline_append: Option<String>,
#[arg(help = "Container image for zone to use")]
oci: String,
#[arg(
@ -166,6 +170,10 @@ impl ZoneLaunchCommand {
.iter()
.map(|name| ZoneSpecDevice { name: name.clone() })
.collect(),
kernel_options: Some(ZoneKernelOptionsSpec {
verbose: self.kernel_verbose,
cmdline_append: self.kernel_cmdline_append.clone().unwrap_or_default(),
}),
}),
};
let response = client

View File

@ -26,7 +26,7 @@ pub mod logs;
pub mod metrics;
pub mod resolve;
pub mod top;
mod update_resources;
pub mod update_resources;
pub mod watch;
#[derive(Parser)]
@ -46,6 +46,7 @@ impl ZoneCommand {
}
}
#[allow(clippy::large_enum_variant)]
#[derive(Subcommand)]
pub enum ZoneCommands {
Attach(ZoneAttachCommand),