[Libvirt-cim] [PATCH] [TEST] Call destroy_netpool() to remove the created netpool in tc

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Jul 30 19:26:21 UTC 2008


yunguol at cn.ibm.com wrote:
> # HG changeset patch
> # User Guolian Yun <yunguol at cn.ibm.com>
> # Date 1217401967 25200
> # Node ID 484734992819e58369974ac579a6c39c1bcd0cfa
> # Parent  2efc46fd30f33e06c20ca8c771abed65725a3fdb
> [TEST] Call destroy_netpool() to remove the created netpool in tc
> 
> Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>
> 
> diff -r 2efc46fd30f3 -r 484734992819 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
> --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py	Wed Jul 23 17:42:47 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py	Wed Jul 30 00:12:47 2008 -0700
> @@ -33,7 +33,7 @@
>  from CimTest.Globals import logger, do_main
>  from CimTest.ReturnCodes import PASS, FAIL, XFAIL
>  from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf, \
> -create_netpool_conf
> +create_netpool_conf, destroy_netpool
> 
>  sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
> 
> @@ -152,6 +152,7 @@
>              break
> 
>      cleanup_restore(options.ip, options.virt)
> +    destroy_netpool(options.ip, options.virt, test_network)
>      vsxml.undefine(options.ip)
>      return status 

This test uses the existing netpool, so you're deleting the existing one 
if you add this call.

What I suggest to do is fix the create_diskpool_conf() function so that 
it creates a new netpool as the default.  Then, you'll need to modify 
all the tests that call create_diskpool_conf() to cleanup the netpool 
when the test is done.

And you'll need to change the tests that call create_diskpool_conf() 
with a False argument.

Thoughts?

> diff -r 2efc46fd30f3 -r 484734992819 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
> --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py	Wed Jul 23 17:42:47 2008 -0700
> +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py	Wed Jul 30 00:12:47 2008 -0700
> @@ -63,7 +63,7 @@
>  CIM_ERROR_GETINSTANCE, CIM_ERROR_ASSOCIATORS
>  from XenKvmLib.classes import get_typed_class
>  from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf, \
> -create_netpool_conf
> +create_netpool_conf, destroy_netpool
>  from XenKvmLib.common_util import print_field_error
> 
>  platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
> @@ -148,9 +148,9 @@
>      
>      except Exception, detail:
>          logger.error("Exception: %s", detail)
> -        return FAIL, dpool, npool, mpool, ppool
> +        return FAIL, dpool, npool, mpool, ppool, test_network
> 
> -    return PASS, dpool, npool, mpool, ppool
> +    return PASS, dpool, npool, mpool, ppool, test_network
> 

This is a lot of values to return from a function.  Can you re-write 
this in such a way so that we return only a few values?  I'd like to see 
no more than 2 if possible.

Thanks!

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




More information about the Libvirt-cim mailing list