From b7983a2683ffb5ce6fea51d8de38a15c31323f67 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 22 Feb 2022 05:21:27 +0900 Subject: [PATCH] vm run --log Just like run-app command, run supports --log flag to redirect the VM log output. Bug: 218934597 Test: vm run --log ... Change-Id: I077a6d22cfc10b4e537b73f8ed0cd7f838a81231 --- vm/src/main.rs | 7 ++++++- vm/src/run.rs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vm/src/main.rs b/vm/src/main.rs index d215d7cf..80ea9be2 100644 --- a/vm/src/main.rs +++ b/vm/src/main.rs @@ -121,6 +121,10 @@ enum Opt { /// Path to file for VM console output. #[structopt(long)] console: Option, + + /// Path to file for VM log output. + #[structopt(long)] + log: Option, }, /// Stop a virtual machine running in the background Stop { @@ -213,12 +217,13 @@ fn main() -> Result<(), Error> { cpu_affinity, &extra_idsigs, ), - Opt::Run { config, daemonize, cpus, cpu_affinity, console } => { + Opt::Run { config, daemonize, cpus, cpu_affinity, console, log } => { command_run( service, &config, daemonize, console.as_deref(), + log.as_deref(), /* mem */ None, cpus, cpu_affinity, diff --git a/vm/src/run.rs b/vm/src/run.rs index 6a0fc159..ef38d7db 100644 --- a/vm/src/run.rs +++ b/vm/src/run.rs @@ -117,11 +117,13 @@ pub fn command_run_app( } /// Run a VM from the given configuration file. +#[allow(clippy::too_many_arguments)] pub fn command_run( service: Strong, config_path: &Path, daemonize: bool, console_path: Option<&Path>, + log_path: Option<&Path>, mem: Option, cpus: Option, cpu_affinity: Option, @@ -142,7 +144,7 @@ pub fn command_run( &format!("{:?}", config_path), daemonize, console_path, - None, + log_path, ) }