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

@ -37,7 +37,8 @@ pub struct ZoneLaunchRequest {
pub env: HashMap<String, String>,
pub run: Option<Vec<String>>,
pub pcis: Vec<PciDevice>,
pub debug: bool,
pub kernel_verbose: bool,
pub kernel_cmdline_append: String,
pub image: OciPackedImage,
pub addons_image: Option<PathBuf>,
pub network: ZoneLaunchNetwork,
@ -139,9 +140,14 @@ impl ZoneLauncher {
None
};
let mut cmdline_options = ["console=hvc0"].to_vec();
if !request.debug {
if !request.kernel_verbose {
cmdline_options.push("quiet");
}
if !request.kernel_cmdline_append.is_empty() {
cmdline_options.push(&request.kernel_cmdline_append);
}
let cmdline = cmdline_options.join(" ");
let zone_mac_string = request.network.zone_mac.to_string().replace('-', ":");

View File

@ -307,11 +307,13 @@ impl Runtime {
}
pub async fn read_hypervisor_console(&self, clear: bool) -> Result<Arc<str>> {
let index = 0 as u32;
let (rawbuf, newindex) = self.context
.xen
.call
.read_console_ring_raw(clear, index).await?;
let index = 0_u32;
let (rawbuf, newindex) = self
.context
.xen
.call
.read_console_ring_raw(clear, index)
.await?;
let buf = std::str::from_utf8(&rawbuf[..newindex as usize])?;
Ok(Arc::from(buf))
}