vmm: Remove the Vmm structure

The Vmm structure is just a placeholder for the KVM instance. We can
create it directly from the VM creation routine instead.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-09-24 01:12:07 +02:00
parent 9c5135da7a
commit bdfd1a3f38
3 changed files with 8 additions and 18 deletions

View File

@@ -3,11 +3,9 @@
// SPDX-License-Identifier: Apache-2.0
//
extern crate kvm_ioctls;
#[macro_use]
extern crate log;
use kvm_ioctls::*;
use std::fmt::{self, Display};
use std::result;
@@ -40,21 +38,9 @@ impl Display for Error {
}
}
struct Vmm {
kvm: Kvm,
}
impl Vmm {
fn new() -> Result<Self> {
let kvm = Kvm::new().expect("new KVM instance creation failed");
Ok(Vmm { kvm })
}
}
pub fn boot_kernel(config: VmConfig) -> Result<()> {
pub fn start_vm_loop(config: VmConfig) -> Result<()> {
loop {
let vmm = Vmm::new()?;
let mut vm = Vm::new(&vmm.kvm, &config).map_err(Error::VmNew)?;
let mut vm = Vm::new(&config).map_err(Error::VmNew)?;
if vm.start().map_err(Error::VmStart)? == ExitBehaviour::Shutdown {
break;