vmm: validate payload correctly when IGVM is provided
While an IGVM is provided validation fails as there is no kernel or firmware. This patch fixes the sev_snp boot failure. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
parent
5549d846da
commit
8e40413886
1 changed files with 13 additions and 0 deletions
|
|
@ -691,6 +691,10 @@ pub enum PayloadConfigError {
|
|||
/// No bootitem provided: neither firmware nor kernel.
|
||||
#[error("No bootitem provided: neither firmware nor kernel")]
|
||||
MissingBootitem,
|
||||
#[cfg(feature = "igvm")]
|
||||
/// Specifying a kernel or firmware is not supported when an igvm is provided.
|
||||
#[error("Specifying a kernel or firmware is not supported when an igvm is provided")]
|
||||
IgvmPlusOtherPayloads,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
|
|
@ -790,6 +794,15 @@ impl PayloadConfig {
|
|||
/// Succeeds if Cloud Hypervisor will be able to boot the configuration.
|
||||
/// Further, warns for some odd configurations.
|
||||
pub fn validate(&mut self) -> Result<(), PayloadConfigError> {
|
||||
#[cfg(feature = "igvm")]
|
||||
{
|
||||
if self.igvm.is_some() {
|
||||
if self.firmware.is_some() || self.kernel.is_some() {
|
||||
return Err(PayloadConfigError::IgvmPlusOtherPayloads);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
match (&self.firmware, &self.kernel) {
|
||||
(Some(_firmware), Some(_kernel)) => Err(PayloadConfigError::FirmwarePlusOtherPayloads),
|
||||
(Some(_firmware), None) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue