mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Make --kernel optional
The kernel path was the only mandatory command line option. With the addition of the --api-socket option, we can run without a kernel path and get it later through the API. Since we can end up with VM configurations that are no longer valid by default, we need to provide a validation check for it. For now, if the kernel path is not defined, the VM configuration is invalid. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -463,7 +463,8 @@ fn get_host_cpu_phys_bits() -> u8 {
|
||||
impl Vm {
|
||||
pub fn new(config: Arc<VmConfig>, exit_evt: EventFd, reset_evt: EventFd) -> Result<Self> {
|
||||
let kvm = Kvm::new().map_err(Error::KvmNew)?;
|
||||
let kernel = File::open(&config.kernel.path).map_err(Error::KernelFile)?;
|
||||
let kernel =
|
||||
File::open(&config.kernel.as_ref().unwrap().path).map_err(Error::KernelFile)?;
|
||||
let fd = kvm.create_vm().map_err(Error::VmCreate)?;
|
||||
let fd = Arc::new(fd);
|
||||
let creation_ts = std::time::Instant::now();
|
||||
|
||||
Reference in New Issue
Block a user