mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 23:11:16 +00:00
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
@ -44,3 +44,11 @@ pub use crate::hypervisor::{Hypervisor, HypervisorError};
|
|||||||
pub use cpu::{HypervisorCpuError, Vcpu, VmExit};
|
pub use cpu::{HypervisorCpuError, Vcpu, VmExit};
|
||||||
pub use kvm::*;
|
pub use kvm::*;
|
||||||
pub use vm::{DataMatch, HypervisorVmError, Vm};
|
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…
Reference in New Issue
Block a user