diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs index 66402f412..45c48f864 100644 --- a/hypervisor/src/lib.rs +++ b/hypervisor/src/lib.rs @@ -44,3 +44,11 @@ pub use crate::hypervisor::{Hypervisor, HypervisorError}; pub use cpu::{HypervisorCpuError, Vcpu, VmExit}; pub use kvm::*; pub use vm::{DataMatch, HypervisorVmError, Vm}; + +use std::sync::Arc; +pub fn new() -> std::result::Result, HypervisorError> { + #[cfg(feature = "kvm")] + let hv = kvm::KvmHypervisor::new()?; + + Ok(Arc::new(hv)) +}