summary refs log tree commit diff
path: root/gnu/system/vm.scm
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2016-02-22 11:23:14 -0800
committerChristopher Allan Webber <cwebber@dustycloud.org>2016-02-22 13:28:58 -0800
commit944d2b17b50b6e1890817d4724ed101bc2c4b0ef (patch)
tree543500c438d420451a6a7fc8bc6b7b4ff68d80be /gnu/system/vm.scm
parent8b16a5e1996bd9ec66915f84beaac6d34cb0f353 (diff)
downloadguix-944d2b17b50b6e1890817d4724ed101bc2c4b0ef.tar.gz
vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.
Fixes <http://bugs.gnu.org/22633>.

* gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
  if "/dev/kvm" is present.
* gnu/system/vm.scm (common-kvm-options): Same as above.
Diffstat (limited to 'gnu/system/vm.scm')
-rw-r--r--gnu/system/vm.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index a7c03bda17..58a476a468 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -1,5 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
+;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -457,7 +459,13 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
                      "\" "))
 
   #~(string-append
-     " -enable-kvm -no-reboot -net nic,model=virtio \
+     ;; Only enable kvm if we see /dev/kvm exists.
+     ;; This allows users without hardware virtualization to still use these
+     ;; commands.
+     #$(if (file-exists? "/dev/kvm")
+           " -enable-kvm "
+           "")
+     " -no-reboot -net nic,model=virtio \
   " #$@(map virtfs-option shared-fs) " \
   -net user \
   -serial stdio -vga std \