From: Avi Kivity <avi@redhat.com>
To: Lucas Meneghel Rodrigues <lmr@redhat.com>
Cc: Mike Burns <mburns@redhat.com>,
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 19:40:18 +0300 [thread overview]
Message-ID: <4A1AC9F2.9030000@redhat.com> (raw)
In-Reply-To: <1243258893.2838.18.camel@localhost.localdomain>
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
next prev parent reply other threads:[~2009-05-25 16:40 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
2009-05-25 16:40 ` Avi Kivity [this message]
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=4A1AC9F2.9030000@redhat.com \
--to=avi@redhat.com \
--cc=dhuff@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
--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