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

2012-03-27 Thread Martin Kletzander
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2012-03-27 Thread Guannan Ren

On 03/27/2012 03:55 PM, Martin Kletzander wrote:

On 03/26/2012 03:15 PM, Guannan Ren wrote:


   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


  It'd better to have an explicit setting for default uri.
  we don't need $defaulturi in case config file,  the framework add 
it for us.

  When we don't give value to defaulturi in env.cfg like
defaulturi = 
 it works like defaulturi = None, so it's okay here.

 Guannan Ren

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


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

2012-03-26 Thread Guannan Ren

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.



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


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

2012-03-24 Thread Martin Kletzander
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

-- 
1.7.3.4

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