From bf4894692467528c2c4d8cf31bcdc1da8aa4c7bd Mon Sep 17 00:00:00 2001 From: Jamie McClelland Date: Fri, 26 May 2017 10:43:26 -0400 Subject: Option to use alternative disk driver instead of default virtio 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kvm-manager b/kvm-manager index c4bfccb..a46f26a 100755 --- a/kvm-manager +++ b/kvm-manager @@ -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 -- cgit v1.2.3