diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2016-01-19 18:04:38 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2016-01-19 18:05:52 +0100 |
commit | 27e9f2f465267043283faaf9672e5ed578b72faf (patch) | |
tree | 00abe2716b676aaf1b62ed7ad01ada6220686e06 | |
parent | f7ea916622d78715b32d2b475ca5ef0e09ddc49b (diff) |
KVM_USER: be a bit more flexible with vfio's pci-id and arbitrarily give key dirs
-rwxr-xr-x | kvm-wrapper.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kvm-wrapper.sh b/kvm-wrapper.sh index 13887fc..8a26a37 100755 --- a/kvm-wrapper.sh +++ b/kvm-wrapper.sh @@ -393,7 +393,7 @@ function pci_vfiofy() pci_bind_driver "vfio-pci" "$1" if [[ -n "$KVM_USER" ]]; then - local IOMMU_GROUP=$(readlink "/sys/bus/pci/drivers/vfio-pci/$1/iommu_group") + local IOMMU_GROUP=$(readlink "/sys/bus/pci/drivers/vfio-pci/"*"$1/iommu_group") IOMMU_GROUP=${IOMMU_GROUP##*/} chown $KVM_USER: /dev/vfio/$IOMMU_GROUP fi @@ -614,6 +614,7 @@ function kvm_start_vm () check_create_dir "$PID_DIR" check_create_dir "$MONITOR_DIR" check_create_dir "$SERIAL_DIR" + [[ -n "$KVM_USER" ]] && chown "$KVM_USER" "$PID_DIR" "$MONITOR_DIR" "$SERIAL_DIR" [[ -z "$KVM_BIN" ]] && KVM_BIN="/usr/bin/kvm" require_exec "$KVM_BIN" |