Support sending VM log output to a file.
Bug: 191613547
Test: Ran VM manually with log to file and without
Change-Id: I2bc0c3e76c537e5e5ce762d902806482d4820af5
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 2c93ec4..b79f42a 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -43,6 +43,10 @@
/// Detach VM from the terminal and run in the background
#[structopt(short, long)]
daemonize: bool,
+
+ /// Path to file for VM log output.
+ #[structopt(short, long)]
+ log: Option<PathBuf>,
},
/// Stop a virtual machine running in the background
Stop {
@@ -73,7 +77,9 @@
.context("Failed to find VirtualizationService")?;
match opt {
- Opt::Run { config, daemonize } => command_run(service, &config, daemonize),
+ Opt::Run { config, daemonize, log } => {
+ command_run(service, &config, daemonize, log.as_deref())
+ }
Opt::Stop { cid } => command_stop(service, cid),
Opt::List => command_list(service),
Opt::CreatePartition { path, size } => command_create_partition(service, &path, size),