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 <pmores@redhat.com>
This commit is contained in:
Pavel Mores
2024-01-27 13:46:35 +01:00
parent ee072e8a06
commit b52a398469

View File

@@ -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