Add method to get list of VMs for vm tool.
Bug: 181869875
Test: Ran on VIM3L
Change-Id: I90506962171d6c16469e265521b435bec905e0f4
diff --git a/virtmanager/src/crosvm.rs b/virtmanager/src/crosvm.rs
index 057b791..4ae1fcd 100644
--- a/virtmanager/src/crosvm.rs
+++ b/virtmanager/src/crosvm.rs
@@ -29,19 +29,22 @@
child: Child,
/// The CID assigned to the VM for vsock communication.
pub cid: Cid,
+ /// The filename of the config file that was used to start the VM. This may have changed since
+ /// it was read so it shouldn't be trusted; it is only stored for debugging purposes.
+ pub config_path: String,
}
impl VmInstance {
/// Create a new `VmInstance` for the given process.
- fn new(child: Child, cid: Cid) -> VmInstance {
- VmInstance { child, cid }
+ fn new(child: Child, cid: Cid, config_path: &str) -> VmInstance {
+ VmInstance { child, cid, config_path: config_path.to_owned() }
}
/// Start an instance of `crosvm` to manage a new VM. The `crosvm` instance will be killed when
/// the `VmInstance` is dropped.
- pub fn start(config: &VmConfig, cid: Cid) -> Result<VmInstance, Error> {
+ pub fn start(config: &VmConfig, cid: Cid, config_path: &str) -> Result<VmInstance, Error> {
let child = run_vm(config, cid)?;
- Ok(VmInstance::new(child, cid))
+ Ok(VmInstance::new(child, cid, config_path))
}
}