feature(xen-preflight): test for hypervisor presence explicitly and error if missing

Fixes #309
This commit is contained in:
Ariadne Conill 2024-08-19 17:13:40 -07:00
parent 2ab2cda937
commit fa76ec1215
No known key found for this signature in database

View File

@ -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<Self> {
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)),