cloud-hypervisor: Add devices crate

Based on the Firecracker devices crate from commit 9cdb5b2.

It is a trimmed down version compared to the Firecracker one, to remove
a bunch of pulled dependencies (logger, metrics, rate limiter, etc...).

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-03-07 14:56:43 +01:00
parent 7e2d1aca2d
commit 1853b350ee
10 changed files with 840 additions and 24 deletions

View File

@@ -6,10 +6,10 @@
extern crate kvm_ioctls;
use kvm_ioctls::*;
use std::path::Path;
pub mod vm;
use self::vm::{Result, Vm};
use self::vm::{Result, Vm, VmConfig};
struct Vmm {
kvm: Kvm,
@@ -22,9 +22,9 @@ impl Vmm {
}
}
pub fn boot_kernel(kernel: &Path) -> Result<()> {
pub fn boot_kernel(config: VmConfig) -> Result<()> {
let vmm = Vmm::new()?;
let mut vm = Vm::new(&vmm.kvm, kernel)?;
let mut vm = Vm::new(&vmm.kvm, config)?;
let entry = vm.load_kernel()?;
vm.start(entry)?;