mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
246890802b
commit
0e7fcc623e
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user