diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 9ef0ab6b..b890cde5 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3326,8 +3326,12 @@ sub config_to_command { $size_str = ",size=" . (-s $ovmf_vars); } - # on slower ceph clusters, booting without cache on efidisk can take a while, see #3329 - my $cache = $path =~ m/^rbd:/ ? ',cache=writeback' : ''; + # SPI flash does lots of read-modify-write OPs, without writeback this gets really slow #3329 + my $cache = ""; + if ($path =~ m/^rbd:/) { + $cache = ',cache=writeback'; + $path .= ':rbd_cache_policy=writeback'; # avoid write-around, we *need* to cache writes too + } push @$cmd, '-drive', "if=pflash,unit=0,format=raw,readonly=on,file=$ovmf_code"; push @$cmd, '-drive', "if=pflash,unit=1$cache,format=$format,id=drive-efidisk0$size_str,file=${path}${read_only_str}"; diff --git a/test/cfg2cmd/efidisk-on-rbd.conf.cmd b/test/cfg2cmd/efidisk-on-rbd.conf.cmd index 249b132b..ece87ce2 100644 --- a/test/cfg2cmd/efidisk-on-rbd.conf.cmd +++ b/test/cfg2cmd/efidisk-on-rbd.conf.cmd @@ -10,7 +10,7 @@ -daemonize \ -smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e688' \ -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/usr/share/pve-edk2-firmware//OVMF_CODE.fd' \ - -drive 'if=pflash,unit=1,cache=writeback,format=raw,id=drive-efidisk0,size=131072,file=rbd:cpool/vm-100-disk-1:mon_host=127.0.0.42;127.0.0.21;[\:\:1]:auth_supported=none' \ + -drive 'if=pflash,unit=1,cache=writeback,format=raw,id=drive-efidisk0,size=131072,file=rbd:cpool/vm-100-disk-1:mon_host=127.0.0.42;127.0.0.21;[\:\:1]:auth_supported=none:rbd_cache_policy=writeback' \ -smp '1,sockets=1,cores=1,maxcpus=1' \ -nodefaults \ -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \