mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-23 06:05:21 +00:00
vmm: vm: Open kernel and initramfs once all managers are created
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
0646a90626
commit
c73c9b112c
@ -299,18 +299,6 @@ impl Vm {
|
||||
) -> Result<Self> {
|
||||
let (kvm, fd) = Vm::kvm_new()?;
|
||||
|
||||
let kernel = File::open(&config.lock().unwrap().kernel.as_ref().unwrap().path)
|
||||
.map_err(Error::KernelFile)?;
|
||||
|
||||
let initramfs = config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initramfs
|
||||
.as_ref()
|
||||
.map(|i| File::open(&i.path))
|
||||
.transpose()
|
||||
.map_err(Error::InitramfsFile)?;
|
||||
|
||||
let memory_manager = MemoryManager::new(fd.clone(), &config.lock().unwrap().memory.clone())
|
||||
.map_err(Error::MemoryManager)?;
|
||||
|
||||
@ -335,6 +323,18 @@ impl Vm {
|
||||
.map_err(Error::CpuManager)?;
|
||||
|
||||
let on_tty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
|
||||
let kernel = File::open(&config.lock().unwrap().kernel.as_ref().unwrap().path)
|
||||
.map_err(Error::KernelFile)?;
|
||||
|
||||
let initramfs = config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.initramfs
|
||||
.as_ref()
|
||||
.map(|i| File::open(&i.path))
|
||||
.transpose()
|
||||
.map_err(Error::InitramfsFile)?;
|
||||
|
||||
Ok(Vm {
|
||||
kernel,
|
||||
initramfs,
|
||||
|
Loading…
Reference in New Issue
Block a user