From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Mike Burns <mburns@redhat.com>
Cc: kvm@vger.kernel.org, ulublin@redhat.com, dhuff@redhat.com
Subject: Re: [PATCH][KVM-AUTOTEST] Make code to remove kvm modules more robust
Date: Mon, 25 May 2009 10:41:33 -0300 [thread overview]
Message-ID: <1243258893.2838.18.camel@localhost.localdomain> (raw)
In-Reply-To: <1242849851-8029-1-git-send-email-mburns@redhat.com>
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.
Other than that, I agree with Avi that we should avoid adding commented
lines, and prefer python constructs over shell ones.
--
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
next prev parent reply other threads:[~2009-05-25 13:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 20:04 [PATCH][KVM-AUTOTEST] Make code to remove kvm modules more robust Mike Burns
2009-05-24 15:36 ` Avi Kivity
2009-05-25 13:41 ` Lucas Meneghel Rodrigues [this message]
2009-05-25 16:40 ` Avi Kivity
2009-05-26 4:43 ` 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=1243258893.2838.18.camel@localhost.localdomain \
--to=lmr@redhat.com \
--cc=dhuff@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mburns@redhat.com \
--cc=ulublin@redhat.com \
/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