vmspawn: Fix shared memory check
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 19 Apr 2024 11:41:49 +0000 (13:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 19 Apr 2024 14:22:07 +0000 (16:22 +0200)
We need the shared memory added if we're doing runtime mounts as well.

src/vmspawn/vmspawn.c

index 0eba4569715140e207f4d32e7ad95c87b5243279..d3d37fd5d324790233dfd9f23068d01d51250ca2 100644 (file)
@@ -1248,7 +1248,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
                 log_warning("Couldn't find OVMF firmware blob with Secure Boot support, "
                             "falling back to OVMF firmware blobs without Secure Boot support.");
 
-        shm = arg_directory ? ",memory-backend=mem" : "";
+        shm = arg_directory || arg_runtime_mounts.n_mounts != 0 ? ",memory-backend=mem" : "";
         if (ARCHITECTURE_SUPPORTS_SMM)
                 machine = strjoin("type=" QEMU_MACHINE_TYPE ",smm=", on_off(ovmf_config->supports_sb), shm);
         else