Re: [test-API PATCH 7/7] domain/[start|destroy]: Add a optional noping flag to skip the ping test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/21/2012 06:13 PM, Guannan Ren wrote:
> On 03/21/2012 08:46 PM, Peter Krempa wrote:
>> For some tests it's not needed to ping the guest in the startup process.
>> This patch adds a flag to the start and destroy test to skip such
>> attempts (that consume a lot of time)
>> ---
>>   repos/domain/destroy.py |   54
>> ++++++++++++++++++++++++++--------------------
>>   repos/domain/start.py   |   50
>> ++++++++++++++++++++----------------------
>>   2 files changed, 54 insertions(+), 50 deletions(-)
>>
>> diff --git a/repos/domain/destroy.py b/repos/domain/destroy.py
>> index f98b602..12399d6 100644
>> --- a/repos/domain/destroy.py
>> +++ b/repos/domain/destroy.py
>> @@ -50,7 +50,10 @@ def destroy(params):
>>          {'guestname': guestname}
>>
>>          logger -- an object of utils/Python/log.py
>> -       guestname -- same as the domain name
>> +       guestname -- the domain name
>> +       flags -- optional arguments:
>> +                  noping: Don't do the ping test
>> +
>>
>>          Return 0 on SUCCESS or 1 on FAILURE
>>       """
>> @@ -62,6 +65,7 @@ def destroy(params):
>>       if params_check_result:
>>           return 1
>>       guestname = params['guestname']
>> +    flags = params['flags']
> 
>           The 'flags' is optional, then we have to check if the
> dictionary of params has key or not
>           if params.has_key('flags'):
>               ...
>           otherwise, it will report "KeyError: "
> 
>           If 'flags' is mandatory,  it'd better to to check it in
> check_params function.
> 

I'd rather do it using the get() method for dictionaries with some
default, i.e. params.get('flags', None).

Just my $0.02
Martin

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]