vmspawn: Use virtio-blk-pci for image instead of virtio-scsi-pci

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.
This commit is contained in:
DaanDeMeyer
2025-07-03 14:50:05 +02:00
committed by Daan De Meyer
parent 6ed684db41
commit 1f24a954e4

View 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();