hypervisor: add a function to return hypervisor type

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2022-07-20 10:41:13 +00:00
committed by Liu Wei
parent d56263706d
commit 9fc3379e8d
4 changed files with 25 additions and 0 deletions

View File

@@ -61,6 +61,12 @@ pub use vm::{
Vm, VmOps,
};
#[derive(Debug, Copy, Clone)]
pub enum HypervisorType {
Kvm,
Mshv,
}
pub fn new() -> std::result::Result<Arc<dyn Hypervisor>, HypervisorError> {
#[cfg(feature = "kvm")]
let hv = kvm::KvmHypervisor::new()?;