From: Daan De Meyer Date: Tue, 22 Oct 2024 17:40:10 +0000 (+0200) Subject: Use virtio-blk-pci unless scsi-hd is really needed X-Git-Tag: v25~212^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8abce5ac9c8a5dd45993effc72accb522dfe6c0b;p=thirdparty%2Fmkosi.git Use virtio-blk-pci unless scsi-hd is really needed 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. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index f089d8d21..d2534d06f 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -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 (