Add assignable devices to vm info
"vm info" command will now show a list of assignable devices. This will
be helpful for
1) host tests which can't directly interact with virtualization service
2) users who want to test device assignment (on shell)
Bug: 294799577
Test: adb shell /apex/com.android.virt/bin/vm info
Change-Id: I8226e8b46f769e0159725a246efd9fbc8f105ebe
diff --git a/vm/src/main.rs b/vm/src/main.rs
index 64bcd02..793d87c 100644
--- a/vm/src/main.rs
+++ b/vm/src/main.rs
@@ -444,6 +444,10 @@
println!("VFIO-platform is not supported.");
}
+ let devices = get_service()?.getAssignableDevices()?;
+ let devices = devices.into_iter().map(|x| x.node).collect::<Vec<_>>();
+ println!("Assignable devices: {}", serde_json::to_string(&devices)?);
+
Ok(())
}