tdx: Permit starting Cloud Hypervisor without --kernel

This is not required if TDX is present.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-02-12 16:45:02 +00:00
parent 62abc117ab
commit 57c8c250fd
2 changed files with 2 additions and 1 deletions

View File

@ -430,7 +430,7 @@ fn start_vmm(cmd_arguments: ArgMatches, api_socket_path: &str) -> Result<(), Err
// Can't test for "vm-config" group as some have default values. The kernel
// is the only required option for booting the VM.
if cmd_arguments.is_present("kernel") {
if cmd_arguments.is_present("kernel") || cmd_arguments.is_present("tdx") {
let vm_params = config::VmParams::from_arg_matches(&cmd_arguments);
let vm_config = config::VmConfig::parse(vm_params).map_err(Error::ParsingConfig)?;

View File

@ -1531,6 +1531,7 @@ pub struct VmConfig {
impl VmConfig {
pub fn validate(&self) -> ValidationResult<()> {
#[cfg(not(feature = "tdx"))]
self.kernel.as_ref().ok_or(ValidationError::KernelMissing)?;
if self.console.mode == ConsoleOutputMode::Tty && self.serial.mode == ConsoleOutputMode::Tty