aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie McClelland <jm@mayfirst.org>2017-05-26 10:43:26 -0400
committerJamie McClelland <jm@mayfirst.org>2017-05-26 13:43:00 -0400
commitbf4894692467528c2c4d8cf31bcdc1da8aa4c7bd (patch)
tree3a34a5d6a70f9d1bfea06f1d5887b3b521083138
parent9a5037f1e1ffcde13c28d366e05f3c327e566386 (diff)
downloadkvm-manager-bf4894692467528c2c4d8cf31bcdc1da8aa4c7bd.tar.gz
kvm-manager-bf4894692467528c2c4d8cf31bcdc1da8aa4c7bd.tar.bz2
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.
-rwxr-xr-xkvm-manager8
1 files 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