[Pkg-libvirt-commits] [libguestfs] 133/156: launch: direct: Only issue Debian /dev/kvm group warning if /dev/kvm wasn't openable (RHBZ#1130189).

Hilko Bengen bengen at moszumanska.debian.org
Sat Aug 30 08:26:14 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 905e5e9c592d15bc028dc06c752c1299fd5b3df3
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Thu Aug 14 15:16:06 2014 +0100

    launch: direct: Only issue Debian /dev/kvm group warning if /dev/kvm wasn't openable (RHBZ#1130189).
    
    This warning was meant for the case where /dev/kvm is inaccessible and
    the user must add themselves to a special group.
    
    However we didn't take into account whether /dev/kvm was openable in
    this test.  If it's openable, no point issuing the warning.
    
    Move the is_openable ("/dev/kvm") test earlier, and don't issue the
    warning if that was successful.
    
    (cherry picked from commit 9609521734c661ec70c34a68f6201a2601190fa6)
---
 src/launch-direct.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/launch-direct.c b/src/launch-direct.c
index 604c6a9..eab3e89 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -288,9 +288,17 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
     return -1;
   }
 
+  /* Try to guess if KVM is available.  We are just checking that
+   * /dev/kvm is openable.  That's not reliable, since /dev/kvm
+   * might be openable by qemu but not by us (think: SELinux) in
+   * which case the user would not get hardware virtualization,
+   * although at least shouldn't fail.
+   */
+  has_kvm = is_openable (g, "/dev/kvm", O_RDWR|O_CLOEXEC);
+
   force_tcg = guestfs___get_backend_setting_bool (g, "force_tcg");
 
-  if (!force_tcg)
+  if (!has_kvm && !force_tcg)
     debian_kvm_warning (g);
 
   guestfs___launch_send_progress (g, 0);
@@ -424,14 +432,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
   warning (g, "qemu debugging is enabled, connect gdb to tcp::1234 to begin");
 #endif
 
-  /* Try to guess if KVM is available.  We are just checking that
-   * /dev/kvm is openable.  That's not reliable, since /dev/kvm
-   * might be openable by qemu but not by us (think: SELinux) in
-   * which case the user would not get hardware virtualization,
-   * although at least shouldn't fail.
-   */
-  has_kvm = is_openable (g, "/dev/kvm", O_RDWR|O_CLOEXEC);
-
   /* The qemu -machine option (added 2010-12) is a bit more sane
    * since it falls back through various different acceleration
    * modes, so try that first (thanks Markus Armbruster).

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list