further improve on #3329, ensure write-back is used over write-around

Suggested-by: Rick Altherr <kc8apf@kc8apf.net>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-05 20:47:42 +02:00
parent e43b19109e
commit 738dc81cba
2 changed files with 7 additions and 3 deletions

View File

@ -3326,8 +3326,12 @@ sub config_to_command {
$size_str = ",size=" . (-s $ovmf_vars); $size_str = ",size=" . (-s $ovmf_vars);
} }
# on slower ceph clusters, booting without cache on efidisk can take a while, see #3329 # SPI flash does lots of read-modify-write OPs, without writeback this gets really slow #3329
my $cache = $path =~ m/^rbd:/ ? ',cache=writeback' : ''; 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=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}"; push @$cmd, '-drive', "if=pflash,unit=1$cache,format=$format,id=drive-efidisk0$size_str,file=${path}${read_only_str}";

View File

@ -10,7 +10,7 @@
-daemonize \ -daemonize \
-smbios 'type=1,uuid=3dd750ce-d910-44d0-9493-525c0be4e688' \ -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=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' \ -smp '1,sockets=1,cores=1,maxcpus=1' \
-nodefaults \ -nodefaults \
-boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \