mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 05:10:55 +00:00
feature(xen-preflight): test for hypervisor presence explicitly and error if missing
Fixes #309
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use krataloopdev::LoopControl;
|
use krataloopdev::LoopControl;
|
||||||
|
use log::debug;
|
||||||
use std::{fs, path::PathBuf, str::FromStr, sync::Arc};
|
use std::{fs, path::PathBuf, str::FromStr, sync::Arc};
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
@ -168,6 +169,13 @@ pub struct Runtime {
|
|||||||
impl Runtime {
|
impl Runtime {
|
||||||
pub async fn new() -> Result<Self> {
|
pub async fn new() -> Result<Self> {
|
||||||
let context = RuntimeContext::new().await?;
|
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 {
|
Ok(Self {
|
||||||
context,
|
context,
|
||||||
launch_semaphore: Arc::new(Semaphore::new(10)),
|
launch_semaphore: Arc::new(Semaphore::new(10)),
|
||||||
|
Reference in New Issue
Block a user