Pick the OVMF variant from an image name like `dstack-0.5.10`. Falls back to `OvmfVariant::default()` (= `Pre202505`) when the image name is missing or doesn't carry a parseable version suffix. Use this only as a fallback for images that pre-date `VmConfig::ovmf_variant`.
(image: Option<&str>)
| 82 | /// missing or doesn't carry a parseable version suffix. Use this only as a |
| 83 | /// fallback for images that pre-date `VmConfig::ovmf_variant`. |
| 84 | pub fn ovmf_variant_for_image(image: Option<&str>) -> OvmfVariant { |
| 85 | image |
| 86 | .and_then(extract_version_from_image_name) |
| 87 | .and_then(|v| ovmf_variant_for_version(v).ok()) |
| 88 | .unwrap_or_default() |
| 89 | } |
| 90 | |
| 91 | #[cfg(test)] |
| 92 | mod ovmf_variant_tests { |
no test coverage detected