]> gitweb.fluxo.info Git - kvm-manager.git/commitdiff
Option to use alternative disk driver instead of default virtio
authorJamie McClelland <jm@mayfirst.org>
Fri, 26 May 2017 14:43:26 +0000 (10:43 -0400)
committerJamie McClelland <jm@mayfirst.org>
Fri, 26 May 2017 17:43:00 +0000 (13:43 -0400)
For example, to use scsi instead of virtio on the disk HDB, create an
environment variable named HDB_DRIVER and set it to scsi. You can set
this variable for any disk by changing the variable name (e.g.
HDA_DRIVER, HDC_DRIVER, etc.) to correspond to the disk for which you
want the driver set.

If you are using an SSD card and you want the fstrim command available,
set the driver to scsi. The value can be any value supported by kvm.

kvm-manager

index c4bfccbe971afdaa863c953327b486468876b47e..a46f26a1d0bc7c2f0269127aab695c55c4c33abb 100755 (executable)
@@ -136,14 +136,18 @@ up() {
     # set up the disks, if needed:
     if [ -n "$HDA" ]; then
        build_disk_io_params HDA
-       KVMARGS="$KVMARGS -drive file=$HDA,if=virtio,cache=none,index=$index,format=raw${first_disk_extra_args}${disk_io_params}"
+       driver=${HDA_DRIVER:-virtio}
+       KVMARGS="$KVMARGS -drive file=$HDA,if=$driver,cache=none,index=$index,format=raw${first_disk_extra_args}${disk_io_params}"
     fi
     # loop here on everything after HDA:
     for disk in HD{B..Z}; do
       index=$(( $index + 1 ))
       if [ -b "${!disk}" ]; then
+        driver=virtio
+        driver_var_name="${disk}_DRIVER"
+        [ -n "${!driver_var_name}" ] && driver=${!driver_var_name}
         build_disk_io_params "${disk}"
-        KVMARGS="$KVMARGS -drive file=${!disk},if=virtio,cache=none,index=$index,format=raw${disk_io_params}"
+        KVMARGS="$KVMARGS -drive file=${!disk},if=$driver,cache=none,index=$index,format=raw${disk_io_params}"
       fi
     done