- speed optimization for kvm using raw block devices (reported by Cristian Rodríguez)
authorAdrian Schröter <adrian@suse.de>
Wed, 20 Jul 2011 10:08:40 +0000 (12:08 +0200)
committerAdrian Schröter <adrian@suse.de>
Wed, 20 Jul 2011 10:08:40 +0000 (12:08 +0200)
build

diff --git a/build b/build
index b160114..790b36d 100755 (executable)
--- a/build
+++ b/build
@@ -1493,10 +1493,15 @@ for SPECFILE in "${SPECFILES[@]}" ; do
        elif [ "$VM_TYPE" = 'qemu' -o "$VM_TYPE" = 'kvm' ]; then
                echo "booting $VM_TYPE ..."
                if [ "$kvm_virtio" = 1 ]; then
-                   qemu_args=(-drive file="$VM_IMAGE",if=virtio -hda "$VM_IMAGE")
+                   CACHE=""
+                    if [ "$VM_TYPE" = 'kvm' -a -b "$VM_IMAGE" ]
+                      # speed optimization when using kvm with raw devices
+                     CACHE=",cache=none"
+                    fi
+                   qemu_args=(-drive file="$VM_IMAGE",if=virtio$CACHE -hda "$VM_IMAGE")
                    if [ -n "$VM_SWAP" ]; then
                        qemu_args=("${qemu_args[@]}" "-drive")
-                       qemu_args=("${qemu_args[@]}" "file=$VM_SWAP,if=virtio")
+                       qemu_args=("${qemu_args[@]}" "file=$VM_SWAP,if=virtio$CACHE")
                    fi
                else
                    qemu_args=(-hda "$VM_IMAGE")