]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: Use virtio-blk-pci for image instead of virtio-scsi-pci
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Thu, 3 Jul 2025 12:50:05 +0000 (14:50 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Jul 2025 14:18:33 +0000 (16:18 +0200)
We don't need a full blown SCSI controller just to present the main
root drive device to the VM. Let's simplify the storage stack by using
virtio-blk-pci instead.

Additionally, virtio-blk-pci is a builtin module in Arch and Fedora
which means we can do qemu direct kernel boot without needing an initrd.

src/vmspawn/vmspawn.c

index 2771b2634982495f3be1517c4d0f85d4da3067f0..0ddc1cdb5afe0c97169dfd5e32e34fc1ff7e07fa 100644 (file)
@@ -1942,7 +1942,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
                         return log_oom();
         }
 
-        if (arg_image || strv_length(arg_extra_drives) > 0) {
+        if (strv_length(arg_extra_drives) > 0) {
                 r = strv_extend_many(&cmdline, "-device", "virtio-scsi-pci,id=scsi");
                 if (r < 0)
                         return log_oom();
@@ -1979,7 +1979,7 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
                 if (r < 0)
                         return log_oom();
 
-                r = strv_extend_many(&cmdline, "-device", "scsi-hd,drive=vmspawn,bootindex=1");
+                r = strv_extend_many(&cmdline, "-device", "virtio-blk-pci,drive=vmspawn,bootindex=1");
                 if (r < 0)
                         return log_oom();