Lucas Meneghel Rodrigues wrote:
Hi Mike,
On Wed, 2009-05-20 at 16:04 -0400, Mike Burns wrote:
+
+def __unload_modules(module):
+ lsmod = os.popen("lsmod | grep \"^%s \"" % module)
+ line_parts = lsmod.readline().split()
+ if len(line_parts) == 0:
+ kvm_log.info("%s not loaded." % module)
+ else:
+ kvm_log.info("Found module %s, checking for dependecies..." %module)
+ if len(line_parts) == 4:
+ submodules = line_parts[3].split(",")
+ for submodule in submodules:
+ __unload_modules(submodule)
+ else:
+ kvm_log.info("No modules dependent on %s" % module )
+
+ kvm_log.info("Removing module: %s" % module)
+ utils.system("/sbin/modprobe -r %s" % module, ignore_status=False)
ignore_status is False by default, so no need to do explicitly pass it
to the function. Also, as we are putting something that can throw an
exception, you can wrap it in a try/except module that throws a
error.TestError exception in case our module removal still fails.
Wrapping every function with try/except defeats the purpose of
exceptions. Can't autotest handle arbitrary exceptions?
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html