+1 from me

Best,
Regards

Daisy (Ô˹úÁ«)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol@cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces@redhat.com wrote on 2008-08-26 08:25:31:

> # HG changeset patch
> # User Kaitlin Rupert <karupert@us.ibm.com>
> # Date 1219709719 25200
> # Node ID 36799a1d7469a97fe7ee115565c7fd666df86b43
> # Parent  0aa0202d972f967d4d255ec247e4ef26c713090c
> [TEST] Remove referenced to log_param.
>
> Tests no longer need to call log_param.  Because of this, the debug
> param of log_param() in Globals.py is no longer needed (was a
> temporary hack).  Add log_level and log_file params incase other
> suites using the infrastructure want to use a different log level orfile name.
>
> Also, change log file from vsmtest.log to cimtest.log.
>
> Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
>
> diff -r 0aa0202d972f -r 36799a1d7469 lib/CimTest/Globals.py
> --- a/lib/CimTest/Globals.py   Mon Aug 25 14:28:30 2008 -0700
> +++ b/lib/CimTest/Globals.py   Mon Aug 25 17:15:19 2008 -0700
> @@ -89,38 +89,27 @@
>      CIM_IP = "localhost"
>  
>  
> -def log_param(debug=None):
> -    #FIXME debug=None is a temporary work around to avoid duplicate
> -    # logging in vsmtest.log because we have log_param in both the
> -    # do_main decorator and the test case's main function.
> -    # We can safely delete the if branch here after all test cases
> -    # have removed the log_param invoke.
> -    if debug == None:
> -        return
> -    else:
> -        logger.setLevel(logging.DEBUG)
> -        #create console handler and set level to debug
> -        ch = logging.StreamHandler()
> -        if debug:
> -            ch.setLevel(logging.ERROR)
> -        else:
> -            ch.setLevel(int(CIM_LEVEL))
> -        #create file handler and set level to debug
> -        fh = logging.FileHandler("vsmtest.log")
> -        fh.setLevel(logging.DEBUG)
> -        #create formatter
> -        formatter = logging.Formatter(\
> -                "%(asctime)s:%(name)s:%(levelname)s   \t-  %(message)s",
> -                datefmt="%a, %d %b %Y %H:%M:%S")
> -        #add formatter to handlers
> -        fh.setFormatter(formatter)
> -        formatter = logging.Formatter("%(levelname)s \t- %(message)s")
> -        ch.setFormatter(formatter)
> -        #add handlers to logger
> -        logger.addHandler(fh)
> -        logger.addHandler(ch)
> -        #Print header
> -        logger.info("====%s Log====", CIM_TC)
> +def log_param(log_level=logging.ERROR, file_name="cimtest.log"):
> +    logger.setLevel(logging.DEBUG)
> +    #create console handler and set level to debug
> +    ch = logging.StreamHandler()
> +    ch.setLevel(log_level)
> +    #create file handler and set level to debug
> +    fh = logging.FileHandler(file_name)
> +    fh.setLevel(logging.DEBUG)
> +    #create formatter
> +    formatter = logging.Formatter(\
> +                        "%(asctime)s:%(name)s:%(levelname)s   \t-  
> %(message)s",
> +                        datefmt="%a, %d %b %Y %H:%M:%S")
> +    #add formatter to handlers
> +    fh.setFormatter(formatter)
> +    formatter = logging.Formatter("%(levelname)s \t- %(message)s")
> +    ch.setFormatter(formatter)
> +    #add handlers to logger
> +    logger.addHandler(fh)
> +    logger.addHandler(ch)
> +    #Print header
> +    logger.info("====%s Log====", CIM_TC)
>  
>  def log_bug(bug_num):
>      logger.info("Known Bug:%s" % bug_num)
> @@ -136,7 +125,7 @@
>          else:
>              def do_try():
>                  try:
> -                    log_param(options.debug==True)
> +                    log_param()
>                      from VirtLib.utils import setup_ssh_key
>                      from XenKvmLib.test_doms import destroy_and_undefine_all
>                      setup_ssh_key()
> diff -r 0aa0202d972f -r 36799a1d7469 suites/libvirt-
> cim/lib/XenKvmLib/common_util.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py   Mon Aug 25
> 14:28:30 2008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py   Mon Aug 25
> 17:15:19 2008 -0700
> @@ -33,7 +33,7 @@
>  from pywbem.cim_obj import CIMInstanceName
>  from XenKvmLib.devices import CIM_Instance
>  from XenKvmLib.classes import get_typed_class
> -from CimTest.Globals import logger, log_param, CIM_ERROR_ENUMERATE, \
> +from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, \
>                              CIM_ERROR_GETINSTANCE
>  from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
>  from VirtLib.live import diskpool_list, virsh_version, net_list, domain_list
> diff -r 0aa0202d972f -r 36799a1d7469 suites/libvirt-cim/lib/XenKvmLib/rasd.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py   Mon Aug 25 14:28:302008 -0700
> +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py   Mon Aug 25 17:15:192008 -0700
> @@ -21,7 +21,7 @@
>  #
>  
>  import sys
> -from CimTest.Globals import log_param, logger
> +from CimTest.Globals import logger
>  from CimTest.ReturnCodes import FAIL, PASS
>  from XenKvmLib import vxml
>  from XenKvmLib.classes import get_typed_class
> diff -r 0aa0202d972f -r 36799a1d7469 suites/libvirt-cim/main.py
> --- a/suites/libvirt-cim/main.py   Mon Aug 25 14:28:30 2008 -0700
> +++ b/suites/libvirt-cim/main.py   Mon Aug 25 17:15:19 2008 -0700
> @@ -82,7 +82,7 @@
>  
>      for group in group_list:
>          g_path = os.path.join(TEST_SUITE, group)
> -        cmd = "cd %s rm && rm %s" % (g_path, "vsmtest.log")
> +        cmd = "cd %s && rm -f %s" % (g_path, "cimtest.log")
>          status, output = commands.getstatusoutput(cmd)
>  
>      print "Cleaned log files."
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim