On Mon, Aug 16, 2021 at 12:38:39PM -0500, Eric Blake wrote:
QEMU 6.1 and earlier default qemu-img to --cache=writeback, but
qemu-nbd to --cache=writethrough, which is inherently slower because
it requires more flushing. Although qemu 6.2 will probably be
changing the default of qemu-nbd for consistency, in the meantime we
can be explicit in our choice for slightly faster testing.
Tests that only read from the image are not altered, as the slowdowns
really only impact writing to qemu-nbd. Documentation examples were
not updated, because there we can just wait for new-enough qemu-nbd
with saner defaults.
Based on a qemu-nbd report by Nir Soffer.
---
copy/copy-file-to-qcow2.sh | 2 +-
fuse/test-qcow2.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/copy/copy-file-to-qcow2.sh b/copy/copy-file-to-qcow2.sh
index dfd870b..24a0ce9 100755
--- a/copy/copy-file-to-qcow2.sh
+++ b/copy/copy-file-to-qcow2.sh
@@ -54,7 +54,7 @@ qemu-img create -f qcow2 $qcow2 $size
# Run qemu-nbd as a separate process so that we can copy to and from
# the single process in two separate operations.
-$QEMU_NBD -f qcow2 -t --socket=$sock --pid-file=$pidfile $qcow2 &
+$QEMU_NBD -f qcow2 --cache=writeback -t --socket=$sock --pid-file=$pidfile $qcow2 &
cleanup_fn kill $!
wait_for_pidfile qemu-nbd $pid
diff --git a/fuse/test-qcow2.sh b/fuse/test-qcow2.sh
index 0545d1d..3bf365c 100755
--- a/fuse/test-qcow2.sh
+++ b/fuse/test-qcow2.sh
@@ -48,7 +48,7 @@ qemu-img convert -f raw $data -O qcow2 $qcow2
rm -rf $mp
mkdir -p $mp
-$VG nbdfuse -r -P $pidfile $mp [ qemu-nbd -f qcow2 $qcow2 ] &
+$VG nbdfuse -r -P $pidfile $mp [ qemu-nbd -f qcow2 --cache=writeback $qcow2 ] &
# Wait for the pidfile to appear.
for i in {1..60}; do
ACK
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html