[PATCH] KVM test: Get rid of a duplicated function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Get rid of unload_module present on kvm_utils, since
the same function is defined on autotest_lib.client.bin.utils.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py   |   21 ---------------------
 client/tests/kvm/tests/build.py |    4 ++--
 2 files changed, 2 insertions(+), 23 deletions(-)

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...")
-- 
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux