From b52a39846963b486fab0e39acdb4d948a043dc77 Mon Sep 17 00:00:00 2001 From: Pavel Mores Date: Sat, 27 Jan 2024 13:46:35 +0100 Subject: [PATCH] runtime-rs: move creation of VM path from start_vm() to prepare_vm() This fixes a flaw pointed out in review of PR #8185. Creation of the directory semantically fits better into VM preparation than VM launch. Signed-off-by: Pavel Mores --- src/runtime-rs/crates/hypervisor/src/qemu/inner.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime-rs/crates/hypervisor/src/qemu/inner.rs b/src/runtime-rs/crates/hypervisor/src/qemu/inner.rs index 32ec6bc0ca..0985185ed8 100644 --- a/src/runtime-rs/crates/hypervisor/src/qemu/inner.rs +++ b/src/runtime-rs/crates/hypervisor/src/qemu/inner.rs @@ -46,15 +46,15 @@ impl QemuInner { info!(sl!(), "Preparing QEMU VM"); self.id = id.to_string(); + let vm_path = [KATA_PATH, self.id.as_str()].join("/"); + std::fs::create_dir_all(vm_path)?; + Ok(()) } pub(crate) async fn start_vm(&mut self, _timeout: i32) -> Result<()> { info!(sl!(), "Starting QEMU VM"); - let vm_path = [KATA_PATH, self.id.as_str()].join("/"); - std::fs::create_dir_all(vm_path)?; - let mut cmdline = QemuCmdLine::new(&self.id, &self.config)?; // If there's a Vsock Device in `self.devices` the vhost-vsock file