[Libvirt-cim] [PATCH] [TEST] Remove log info to the right place

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Dec 8 19:03:21 UTC 2008


yunguol at cn.ibm.com wrote:
> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1228719139 28800
> # Node ID 53c3639c9f6db35026fa06cfda94171ecef9d3ed
> # Parent  701f3228bdfe740f4a504dce1dfab844c812b9d5
> [TEST] Remove log info to the right place
> 
>  Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>
> 
> diff -r 701f3228bdfe -r 53c3639c9f6d suites/libvirt-cim/cimtest/ElementConforms/01_forward.py
> --- a/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py	Wed Dec 03 21:31:09 2008 -0800
> +++ b/suites/libvirt-cim/cimtest/ElementConforms/01_forward.py	Sun Dec 07 22:52:19 2008 -0800
> @@ -93,13 +93,14 @@
>              if assoc_val.items() == ele.items():
>                  managed_ele_values[cn].remove(ele)
>                  return PASS, managed_ele_values
> +            else:
> +                logger.error("%s not in expected list %s", assoc_val, elements)
> +                return FAIL, managed_ele_values

This isn't a valid change.  If your system has multiple diskpools 
defined, the first item in elements might not be the pool you were 
attempting to verify.

So the loop could look like this:

elements = [bootvirtimages, cimtest-diskpool]
for ele in elements:
   if assoc_val.items() == ele.items():

The attributes of bootvirtimages won't match the attributes of the 
cimtest-diskpool (which is the diskpool instance we're looking for).

So if you put an else here, we return a failure incorrectly.

> 
>      except Exception, details:
>          logger.error("verify_fields() exception: %s", details)
>          return FAIL, managed_ele_values
>        
> -    logger.error("%s not in expected list %s", assoc_val, elements)
> -    return FAIL, managed_ele_values

With the return left here as is, we loop through all the items in 
elements.  If we don't find a match, we return a failure.

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list