Skip to content

Commit 9dcbde5

Browse files
committed
q: correctly use KVM or TCG
1. /dev/kvm does not exist: TCG 2. /dev/kvm exists but we don't have proper permission: TCG 3. otherwise: KVM
1 parent 32cbb19 commit 9dcbde5

File tree

1 file changed

+3
-3
lines changed
  • scripts

1 file changed

+3
-3
lines changed

scripts/q

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Todo:
1313
#
14-
# 1. Optionally do not require /dev/kvm permissions
14+
# <del>1. Optionally do not require /dev/kvm permissions</del>
1515
# 2. Verify if this script works under host /mnt/ directory
1616

1717
IS_GUEST=${IS_GUEST:-false}
@@ -108,7 +108,7 @@ host() {
108108

109109
local accel
110110
if [[ "$(uname -m)" = "${VM_ARCH}" ]]; then
111-
if [[ -e /dev/kvm ]]; then
111+
if [[ -e /dev/kvm && -r /dev/kvm && -w /dev/kvm ]]; then
112112
accel+=" -machine accel=kvm:tcg"
113113
accel+=" -enable-kvm"
114114
fi
@@ -121,7 +121,7 @@ host() {
121121
case "${VM_ARCH}" in
122122
x86_64)
123123
if [[ "$(uname -m)" = "${VM_ARCH}" ]]; then
124-
if [[ -e /dev/kvm ]]; then
124+
if [[ -e /dev/kvm && -r /dev/kvm && -w /dev/kvm ]]; then
125125
cpu="host"
126126
else
127127
cpu="max"

0 commit comments

Comments
 (0)