On 02/14/2012 01:03 AM, Chris Evich wrote:
> 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
I want a common method to control libvirtd service instead of constantly 
wrapper new
function, for instance, the following other actions are very useful. Do 
you want to wrapper
all of them?

# service libvirtd
Usage: /etc/init.d/libvirtd 
{start|stop|status|restart|condrestart|reload|force-reload|try-restart}

Maybe, a service_libvirtd_control(action="") are enough, the parameter 
'action' may be the above
'start', 'stop' and 'reload' etc.

Regards,
Alex
>> +
>>
>>    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!
>

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

Reply via email to