test_infra: Implement Display for GuestVmType

Add Display trait implementation for GuestVmType to enable
formatted output of the VM type in logs and diagnostics.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2026-04-01 18:45:16 -07:00
committed by Rob Bradford
parent 0e7fcc623e
commit 11623a2183

View File

@@ -7,7 +7,7 @@
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fmt::Display;
use std::fmt::{Display, Formatter};
use std::fs::OpenOptions;
use std::io::{Read, Seek, SeekFrom, Write};
use std::net::{TcpListener, TcpStream};
@@ -2505,6 +2505,15 @@ impl FromStr for GuestVmType {
}
}
impl Display for GuestVmType {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
GuestVmType::Regular => write!(f, "regular"),
GuestVmType::Confidential => write!(f, "confidential"),
}
}
}
// Get the direct igvm boot file path based on the console type
fn direct_igvm_boot_path(console: Option<&str>) -> Option<PathBuf> {
// get the default hvc0 igvm file if console string is not passed