From 6a6b5b6e0ba54461c853d8b6c85d368a55fe8629 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 19 Aug 2024 17:22:28 -0700 Subject: [PATCH] feature(xen-preflight): test for hypervisor presence explicitly and error if missing (#347) Fixes #309 --- crates/runtime/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index f9fe270..9bbf43e 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -1,5 +1,6 @@ use anyhow::{anyhow, Result}; use krataloopdev::LoopControl; +use log::debug; use std::{fs, path::PathBuf, str::FromStr, sync::Arc}; use tokio::sync::Semaphore; use uuid::Uuid; @@ -168,6 +169,13 @@ pub struct Runtime { impl Runtime { pub async fn new() -> Result { let context = RuntimeContext::new().await?; + debug!("testing for hypervisor presence"); + context + .xen + .call + .get_version_capabilities() + .await + .map_err(|_| anyhow!("hypervisor is not present"))?; Ok(Self { context, launch_semaphore: Arc::new(Semaphore::new(10)),