]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use virtio-blk-pci unless scsi-hd is really needed
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 22 Oct 2024 17:40:10 +0000 (19:40 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 22 Oct 2024 17:40:10 +0000 (19:40 +0200)
https://www.qemu.org/2021/01/19/virtio-blk-scsi-configuration/
mentions that for performance critical use cases, virtio-blk should
be preferred so let's use virtio-blk unless we actually need scsi-hd.

mkosi/qemu.py

index f089d8d21e3276cc9d62e72257d8deafc800b6b4..d2534d06fe16acc95b9d0d6b9357bcf2d651dec3 100644 (file)
@@ -1270,7 +1270,7 @@ def run_qemu(args: Args, config: Config) -> None:
             cache = "cache.writeback=on,cache.direct=on,cache.no-flush=yes,aio=io_uring"
             cmdline += [
                 "-drive", f"if=none,id=scratch,file={scratch},format=raw,discard=on,{cache}",
-                "-device", "scsi-hd,drive=scratch",
+                "-device", "virtio-blk-pci,drive=scratch",
             ]  # fmt: skip
             kcl += [f"systemd.mount-extra=LABEL=scratch:/var/tmp:{config.distribution.filesystem()}"]
 
@@ -1290,7 +1290,7 @@ def run_qemu(args: Args, config: Config) -> None:
             cache = f"cache.writeback=on,cache.direct={yes_no(direct)},cache.no-flush={yes_no(ephemeral)},aio=io_uring"  # noqa: E501
             cmdline += [
                 "-drive", f"if=none,id=mkosi,file={fname},format=raw,discard=on,{cache}",
-                "-device", f"scsi-{'cd' if config.qemu_cdrom else 'hd'},drive=mkosi,bootindex=1{',removable=on' if config.qemu_removable else ''}",  # noqa: E501
+                "-device", f"{'scsi-cd' if config.qemu_cdrom or config.qemu_removable else 'virtio-blk-pci'},drive=mkosi,bootindex=1{',removable=on' if config.qemu_removable else ''}",  # noqa: E501
             ]  # fmt: skip
 
         if config.qemu_swtpm == ConfigFeature.enabled or (