public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues <lmr@redhat.com>
Subject: [PATCH 1/2] KVM test: Do a better job at handling kvm module failures
Date: Mon, 13 Jul 2009 16:26:56 -0300	[thread overview]
Message-ID: <1247513217-21075-1-git-send-email-lmr@redhat.com> (raw)

Developers might want to use the KVM test to verify changes
only on their own local qemu source directory and will use the
'localsrc' install mode on the KVM test control file, and
provide 'load_modules': 'no' option on the params dict inside
the kvm control file. However, that option is not documented and
defaults to 'yes',  and when the code to load kvm modules can't
find a built kvm.ko module inside the source dir, an unhandled
error exception (totally unhelpful) will be thrown.

This patch makes the test throw a much more helpful error message,
helping the developer to figure out what is wrong and fix the
problem.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/kvm_install.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/kvm_install.py b/client/tests/kvm/kvm_install.py
index 10ed7da..7118357 100755
--- a/client/tests/kvm/kvm_install.py
+++ b/client/tests/kvm/kvm_install.py
@@ -30,15 +30,21 @@ def load_kvm_modules(module_dir):
     logging.info("Loading new KVM modules...")
     kvm_module_path = None
     kvm_vendor_module_path = None
+    # Search for the built KVM modules
     for folder, subdirs, files in os.walk(module_dir):
         if "kvm.ko" in files:
             kvm_module_path = os.path.join(folder, "kvm.ko")
             kvm_vendor_module_path = os.path.join(folder, "kvm-%s.ko" % vendor)
     abort = False
-    if not os.path.isfile(kvm_module_path):
-        logging.error("Could not find KVM module that was supposed to be"
-                      " built on the source dir")
-        abort = True
+    if not kvm_module_path:
+        logging.error("Need a directory containing both kernel module and "
+                      "userspace sources.")
+        logging.error("If you are trying to build only KVM userspace and use "
+                      "the KVM modules you have already loaded, put "
+                      "'load_modules': 'no' on the control file 'params' "
+                      "dictionary.")
+        raise error.TestError("Could not find a built kvm.ko module on the "
+                              "source dir.")
     elif not os.path.isfile(kvm_vendor_module_path):
         logging.error("Could not find KVM (%s) module that was supposed to be"
                       " built on the source dir", vendor)
-- 
1.6.2.5


             reply	other threads:[~2009-07-13 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 19:26 Lucas Meneghel Rodrigues [this message]
2009-07-13 19:26 ` [PATCH 2/2] KVM test: Make better documentation of the KVM install test params Lucas Meneghel Rodrigues
2009-07-14 13:35   ` Lucas Meneghel Rodrigues
2009-07-14 13:34 ` [PATCH 1/2] KVM test: Do a better job at handling kvm module failures Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247513217-21075-1-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox