From patchwork Mon Jul 13 19:26:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 35427 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6DJRE7w015470 for ; Mon, 13 Jul 2009 19:27:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754906AbZGMT1E (ORCPT ); Mon, 13 Jul 2009 15:27:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754883AbZGMT1D (ORCPT ); Mon, 13 Jul 2009 15:27:03 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52430 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbZGMT1C (ORCPT ); Mon, 13 Jul 2009 15:27:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6DJR1Rp023746; Mon, 13 Jul 2009 15:27:01 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6DJR0pZ010691; Mon, 13 Jul 2009 15:27:00 -0400 Received: from localhost.localdomain (vpn-10-112.bos.redhat.com [10.16.10.112]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6DJQwPd006846; Mon, 13 Jul 2009 15:26:59 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 1/2] KVM test: Do a better job at handling kvm module failures Date: Mon, 13 Jul 2009 16:26:56 -0300 Message-Id: <1247513217-21075-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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)