]> git.proxmox.com Git - qemu-server.git/commitdiff
further improve on #3329, ensure write-back is used over write-around
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Jul 2021 18:47:42 +0000 (20:47 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 5 Jul 2021 18:47:50 +0000 (20:47 +0200)
Suggested-by: Rick Altherr <kc8apf@kc8apf.net>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm
test/cfg2cmd/efidisk-on-rbd.conf.cmd

index 9ef0ab6bbe56c1e11a55a684b146f8bb7a37dfb8..b890cde50b3aa60b689d51c1e26753f8a57d7783 100644 (file)
@@ -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}";
index 249b132bdacb9fca4e10b000da8a1518757a9fa0..ece87ce26db5a5fc88b6a807175ddb63cf566873 100644 (file)
@@ -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' \