test_infra: Implement FromStr for GuestVmType

Add FromStr trait implementation for GuestVmType to enable
parsing from CLI string arguments. Supports "regular" and
"confidential" string values.

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

View File

@@ -2493,6 +2493,18 @@ pub enum GuestVmType {
Confidential,
}
impl FromStr for GuestVmType {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"regular" => Ok(GuestVmType::Regular),
"confidential" => Ok(GuestVmType::Confidential),
_ => Err(()),
}
}
}
// 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