Log details for unexpected failure
Add extra context in various places where we might generate
MICRODROID_UNKNOWN_RUNTIME_ERROR.
Define a mechanism for returning extra context information to the
host, and use this to pass back & log the context (but not return it
to the caller).
Add a test.
Test: atest MicrodroidTests
Test: Manual: see new logging
Change-Id: I5625b92113172c6f0805161702be1b6073d2dcd4
diff --git a/virtualizationservice/src/crosvm.rs b/virtualizationservice/src/crosvm.rs
index fa961c2..749970c 100644
--- a/virtualizationservice/src/crosvm.rs
+++ b/virtualizationservice/src/crosvm.rs
@@ -391,7 +391,12 @@
}
}
-fn death_reason(result: &Result<ExitStatus, io::Error>, failure_reason: &str) -> DeathReason {
+fn death_reason(result: &Result<ExitStatus, io::Error>, mut failure_reason: &str) -> DeathReason {
+ if let Some(position) = failure_reason.find('|') {
+ // Separator indicates extra context information is present after the failure name.
+ error!("Failure info: {}", &failure_reason[(position + 1)..]);
+ failure_reason = &failure_reason[..position];
+ }
if let Ok(status) = result {
match failure_reason {
"PVM_FIRMWARE_PUBLIC_KEY_MISMATCH" => {