[qemu] Fix kvm.modules to exit successfully on non-KVM capable systems

bonzini bonzini at fedoraproject.org
Mon Apr 23 08:12:43 UTC 2012


commit 34104a5fe70e009cacead416e37b303646f99e5a
Author: Paolo Bonzini <pbonzini at redhat.com>
Date:   Mon Apr 23 10:09:13 2012 +0200

    Fix kvm.modules to exit successfully on non-KVM capable systems
    
    Resolves rhbz #814932.

 kvm.modules |   18 +++++++++++-------
 qemu.spec   |    5 ++++-
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/kvm.modules b/kvm.modules
index 6574c3f..5398e0d 100755
--- a/kvm.modules
+++ b/kvm.modules
@@ -1,10 +1,14 @@
 #!/bin/sh
 
-case "$(</proc/cpuinfo)" in
-    *vmx*) vmx=1 ;;
-    *svm*) svm=1 ;;
-esac
+grep vmx /proc/cpuinfo >/dev/null 2>&1 && vmx=1
+grep svm /proc/cpuinfo >/dev/null 2>&1 && svm=1
 
-[ "$vmx" ] && modprobe -b kvm-intel >/dev/null 2>&1
-[ "$svm" ] && modprobe -b kvm-amd >/dev/null 2>&1
-[ "$vmx" -o "$svm" ] && modprobe -b vhost-net >/dev/null 2>&1
+if [ "$vmx" ] || [ "$svm" ]; then
+  [ "$vmx" ] && modprobe -b kvm-intel >/dev/null 2>&1
+  [ "$svm" ] && modprobe -b kvm-amd >/dev/null 2>&1
+
+  # no reason why vhost should not work with TCG, but currently it does not
+  modprobe -b vhost-net >/dev/null 2>&1
+else
+  exit 0
+fi
diff --git a/qemu.spec b/qemu.spec
index 3752fa8..9b554bb 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -38,7 +38,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 1.0
-Release: 15%{?dist}
+Release: 16%{?dist}
 # Epoch because we pushed a qemu-1.0 package
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
@@ -1009,6 +1009,9 @@ fi
 %{_mandir}/man1/qemu-img.1*
 
 %changelog
+* Mon Apr 23 2012 Paolo Bonzini <pbonzini at redhat.com> - 2:1.0-16
+- Fix kvm.modules to exit successfully on non-KVM capable systems (rhbz #814932)
+
 * Thu Apr 19 2012 Hans de Goede <hdegoede at redhat.com> - 2:1.0-15
 - Add a couple of backported QXL/Spice bugfixes
 - Add spice volume control patches


More information about the scm-commits mailing list