On 02/13/2012 03:15 AM, guyanhua wrote:
> Hi All:
>
> This patch adds two new API to libvirt_vm.py file:
> libvirtd_stop() and libvirtd_start().
>
> Signed-off-by: Gu Yanhua<[email protected]>
> ---
>   client/virt/libvirt_vm.py |   24 ++++++++++++++++++++++++
>   1 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
> index 6c0e687..dbe7fab 100644
> --- a/client/virt/libvirt_vm.py
> +++ b/client/virt/libvirt_vm.py
> @@ -29,6 +29,30 @@ def libvirtd_restart():
>           logging.error("Failed to restart libvirtd:\n%s", detail)
>           return False
>
> +def libvirtd_stop():
> +    """
> +    Stop libvirt daemon.
> +    """
> +    try:
> +        utils.run("service libvirtd  stop")
> +        logging.debug("Stop  libvirtd  successfuly")
> +        return True
> +    except error.CmdError, detail:
> +        logging.error("Failed to Stop  libvirtd:\n%s", detail)
> +        return False
> +
> +def libvirtd_start():
> +    """
> +    Start libvirt daemon.
> +    """
> +    try:
> +        utils.run("service libvirtd  start")
> +        logging.debug("Start  libvirtd  successfuly")
> +        return True
> +    except error.CmdError, detail:
> +        logging.error("Failed to Start  libvirtd:\n%s", detail)
> +        return False
> +
>
>   def virsh_cmd(cmd, uri = ""):
>       """
> --
> 1.7.1


This is a great addition!  If you have any, we could probably use some 
more tests in/around the host libvirt stop/start/restart area.  My only 
feedback would be that we could maybe also use similar functions for 
dnsmasq stop/start.  I've noticed that libvirtd will start it (if 
required) but it doesn't always shut down the dnsmasq service.  That can 
cause problems relating to open FDs and sockets if/when libvirtd starts 
again or any host network reconfiguration is needed.

Either way, this is a welcome addition.  Thanks!

-- 
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to