KVM test: fail if qemu complains about KVM module trouble

If qemu is tested without KVM intentionally (e.g. with -no-kvm) it won't
complain and the KVM test won't complain either.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4712 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index aff3f67..c913247 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -647,9 +647,17 @@
                 self.monitors += [monitor]
 
             # Get the output so far, to see if we have any problems with
-            # hugepage setup.
+            # KVM modules or with hugepage setup.
             output = self.process.get_output()
 
+            if re.search("Could not initialize KVM", output, re.IGNORECASE):
+                logging.error("Could not initialize KVM; "
+                              "qemu command:\n%s" % qemu_command)
+                logging.error("Output:" + kvm_utils.format_str_for_message(
+                              self.process.get_output()))
+                self.destroy()
+                return False
+
             if "alloc_mem_area" in output:
                 logging.error("Could not allocate hugepage memory; "
                               "qemu command:\n%s" % qemu_command)