Re: [test-API PATCH 4/6] Add default 'uri' parameter to all tests

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

 



On 03/26/2012 03:15 PM, Guannan Ren wrote:
> On 03/25/2012 01:42 AM, Martin Kletzander wrote:
>> Tests should be able to run on various hypervisors and machines. Now
>> we have only two tests that have an option to do something
>> remotely. This commit allows tests to see 'uri' parameter that they
>> should connect to. However it doesn't have to be used always
>> (migration etc.)
>> ---
>>   generator.py |    6 ++++++
>>   1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/generator.py b/generator.py
>> index 4f4478b..5a4652a 100644
>> --- a/generator.py
>> +++ b/generator.py
>> @@ -154,6 +154,12 @@ class FuncGen(object):
>>               clean_ret = -1
>>               try:
>>                   try:
>> +                    # having 'None' as default ensures we use the
>> +                    # correct URI taken from libvirt (configuration,
>> +                    # environment variables, etc.), but one can always
>> +                    # specify a different machine
>> +                    if 'uri' not in case_params:
>> +                        case_params['uri'] = None
>>                       if case_ref_name != 'sleep':
>>                           case_params['logger'] = case_logger
>>
> 
>           This will create a default option named "uri" on the framework
> side like logger for all of testcases.
>           If we want all of testcases to test a remote server that
> results in adding uri for each of them in test.conf
>           that's not so good.
>           Do you think if it is better to write the default uri in
> env.cfg, then parser it for all of testcases.
> 

This will create the parameter only if it doesn't exist yet. I see no
problem with modifying env.cfg, adding defaulturi='xen:///' in there and
using $defaulturi in all the tests. This should still work. However if
you want to use one URI for all the tests, the default 'None' ensures
that the default libvirt URI will be used. Thus it's enough to modify
/etc/libvirt.conf or use LIBVIRT_DEFAULT_URI, etc. All of the options
should work with the code like this (defaulting to None if no uri is given).

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]