On 02/28/2012 03:43 AM, guyanhua wrote:
> 
> This patch adds service_libvirtd_control API to libvirt_vm.py file.
> 
> Signed-off-by: Gu Yanhua<[email protected]>
> ---
>   client/virt/libvirt_vm.py |   29 +++++++++++++++++++++++++++++
>   1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
> index 74dbad2..c9345e0 100644
> --- a/client/virt/libvirt_vm.py
> +++ b/client/virt/libvirt_vm.py
> @@ -55,6 +55,35 @@ def libvirtd_start():
>           logging.error("Failed to start libvirtd:\n%s", detail)
>           return False
> 
> +def service_libvirtd_control(action):
> +    """
> +    Libvirtd control by action, if cmd executes successfully,
> +    return True, otherwise return False.
> +    If the action is status, return True when it's running,
> +    otherwise return False.
> +    @ param action: start|stop|status|restart|condrestart|
> +      reload|force-reload|try-restart
> +    """
> +    actions = ['start','stop','restart','condrestart','reload',\
> +                'force-reload','try-restart']

^ Here there was no need to include the backslash

> +    if action in actions:
> +        try:
> +            utils.run("service libvirtd %s" % action)
> +            logging.debug("%s libvirtd successfuly", action)
> +            return True
> +        except error.CmdError, detail:
> +            logging.error("Failed to %s libvirtd:\n%s", (action, detail))

^ There was an error lying around here, as it should have been:

logging.error("Failed to %s libvirtd:\n%s", action, detail)

I have fixed the problems and commited the result.

https://github.com/autotest/autotest/commit/12d2a2558511f0b60339b19488bb81ab11558b17

I suppose now you'd like to get rid of the other auxiliary libvirtd
start/stop/whatever functions. Please do that and send patches.

Thanks,

Lucas


_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to