[libvirt] [PATCH] domain:screenshot: Added cleanup function

Osier Yang jyang at redhat.com
Mon Apr 16 02:43:24 UTC 2012


On 2012年04月13日 23:44, Martin Kletzander wrote:
> Added cleanup function to the screeshot testcase. This makes use of
> the new "sharedmod" module.
> ---
>
> WARNING: don't push this before the patch with sharedmod is pushed in
> the repo, otherwise this will not work. Thanks.
>
>   repos/domain/screenshot.py |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
> index 3e727a7..5a12c4b 100644
> --- a/repos/domain/screenshot.py
> +++ b/repos/domain/screenshot.py
> @@ -6,6 +6,7 @@ import os
>   import mimetypes
>
>   import libvirt
> +import sharedmod
>
>   required_params = ('guestname', 'filename',)
>   optional_params = ('screen',)
> @@ -36,6 +37,7 @@ def screenshot(params):
>           logger.debug('Mimetype of the file is %s' % mime)
>
>           ret = st.finish()
> +        sharedmod.dict['screenshot_filename'] = filename

Is it neccessary to set a shared variable in the same case?
IIUC the purpose of sharemod.py, it's for variable sharing
among different test cases. Though the case will work fine,
but it's just redundant, and let's keep things simple.

Osier




More information about the libvir-list mailing list