From patchwork Thu Feb 4 04:01:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 76895 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1441m0p008276 for ; Thu, 4 Feb 2010 04:01:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756273Ab0BDEB0 (ORCPT ); Wed, 3 Feb 2010 23:01:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755253Ab0BDEBZ (ORCPT ); Wed, 3 Feb 2010 23:01:25 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1441Om7022877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Feb 2010 23:01:24 -0500 Received: from localhost.localdomain (vpn-10-106.rdu.redhat.com [10.11.10.106]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1441Mv6011446; Wed, 3 Feb 2010 23:01:23 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Get rid of a duplicated function Date: Thu, 4 Feb 2010 02:01:19 -0200 Message-Id: <1265256079-11763-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 04 Feb 2010 04:01:48 +0000 (UTC) diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py index 7a54e57..a35d056 100644 --- a/client/tests/kvm/kvm_utils.py +++ b/client/tests/kvm/kvm_utils.py @@ -368,27 +368,6 @@ def get_git_branch(repository, branch, srcdir, commit=None, lbranch=None): return srcdir -def unload_module(module_name): - """ - Removes a module. Handles dependencies. If even then it's not possible - to remove one of the modules, it will trhow an error.CmdError exception. - - @param module_name: Name of the module we want to remove. - """ - l_raw = utils.system_output("/sbin/lsmod").splitlines() - lsmod = [x for x in l_raw if x.split()[0] == module_name] - if len(lsmod) > 0: - line_parts = lsmod[0].split() - if len(line_parts) == 4: - submodules = line_parts[3].split(",") - for submodule in submodules: - unload_module(submodule) - utils.system("/sbin/modprobe -r %s" % module_name) - logging.info("Module %s unloaded" % module_name) - else: - logging.info("Module %s is already unloaded" % module_name) - - def check_kvm_source_dir(source_dir): """ Inspects the kvm source directory and verifies its disposition. In some diff --git a/client/tests/kvm/tests/build.py b/client/tests/kvm/tests/build.py index 2e05a56..b569394 100644 --- a/client/tests/kvm/tests/build.py +++ b/client/tests/kvm/tests/build.py @@ -54,10 +54,10 @@ def load_kvm_modules(module_dir=None, load_stock=False, extra_modules=None): kill_qemu_processes() logging.info("Unloading previously loaded KVM modules") - kvm_utils.unload_module("kvm") + utils.unload_module("kvm") if extra_modules: for module in extra_modules: - kvm_utils.unload_module(module) + utils.unload_module(module) if module_dir: logging.info("Loading the built KVM modules...")