hypervisor: introduce a new function
It returns an hypervisor object depending on which hypervisor is configured. Currently it only supports KVM. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
a5c4f0fc6f
commit
a83bd97e0d
1 changed files with 8 additions and 0 deletions
|
|
@ -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<Arc<dyn Hypervisor>, HypervisorError> {
|
||||
#[cfg(feature = "kvm")]
|
||||
let hv = kvm::KvmHypervisor::new()?;
|
||||
|
||||
Ok(Arc::new(hv))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue