[PATCH] [TEST] Fix ResourcePoolConfigurationService.03, 04, 06&07 to work for both Pegasus and sfcb

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1218520874 25200 # Node ID a8604735c04b457abd35327996fae64eb0d5babe # Parent 98f69895a4dcc3d314d41611cf67f51329e15a44 [TEST] Fix ResourcePoolConfigurationService.03,04,06&07 to work for both Pegasus and sfcb Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 98f69895a4dc -r a8604735c04b suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/03_CreateResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/03_CreateResourcePool.py Fri Aug 08 11:01:29 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/03_CreateResourcePool.py Mon Aug 11 23:01:14 2008 -0700 @@ -40,6 +40,7 @@ import sys import pywbem +from VirtLib import utils from XenKvmLib import rpcs_service from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS @@ -47,7 +48,6 @@ from XenKvmLib.classes import get_typed_class cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_desc = "CIM_ERR_NOT_SUPPORTED" cim_mname = "CreateResourcePool" @@ -56,6 +56,14 @@ options = main.options rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ "ResourcePoolConfigurationService"))(options.ip) + + cmd = "lsof -P -i:5988 | grep sfcbd" + rc, out = utils.run_remote(options.ip, cmd) + if rc == 0: + cim_desc = "The requested operation is not supported" + else: + cim_desc = "CIM_ERR_NOT_SUPPORTED" + try: rpcs_conn.CreateResourcePool() except pywbem.CIMError, (err_no, desc): diff -r 98f69895a4dc -r a8604735c04b suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Fri Aug 08 11:01:29 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/04_CreateChildResourcePool.py Mon Aug 11 23:01:14 2008 -0700 @@ -50,13 +50,13 @@ import sys import pywbem from XenKvmLib import rpcs_service +from VirtLib import utils from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS from CimTest.Globals import do_main, platform_sup from XenKvmLib.classes import get_typed_class cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_desc = "CIM_ERR_NOT_SUPPORTED" cim_mname = "CreateChildResourcePool" @do_main(platform_sup) @@ -64,6 +64,13 @@ options = main.options rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ "ResourcePoolConfigurationService"))(options.ip) + cmd = "lsof -P -i:5988 | grep sfcbd" + rc, out = utils.run_remote(options.ip, cmd) + if rc == 0: + cim_desc = "The requested operation is not supported" + else: + cim_desc = "CIM_ERR_NOT_SUPPORTED" + try: rpcs_conn.CreateChildResourcePool() except pywbem.CIMError, (err_no, desc): diff -r 98f69895a4dc -r a8604735c04b suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/06_RemoveResourcesFromResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/06_RemoveResourcesFromResourcePool.py Fri Aug 08 11:01:29 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/06_RemoveResourcesFromResourcePool.py Mon Aug 11 23:01:14 2008 -0700 @@ -46,7 +46,8 @@ import sys -import pywbem +import pywbem +from VirtLib import utils from XenKvmLib import rpcs_service from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS @@ -54,7 +55,6 @@ from XenKvmLib.classes import get_typed_class cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_desc = "CIM_ERR_NOT_SUPPORTED" cim_mname = "RemoveResourcesFromResourcePool" @do_main(platform_sup) @@ -62,6 +62,14 @@ options = main.options rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ "ResourcePoolConfigurationService"))(options.ip) + + cmd = "lsof -P -i:5988 | grep sfcbd" + rc, out = utils.run_remote(options.ip, cmd) + if rc == 0: + cim_desc = "The requested operation is not supported" + else: + cim_desc = "CIM_ERR_NOT_SUPPORTED" + try: rpcs_conn.RemoveResourcesFromResourcePool() except pywbem.CIMError, (err_no, desc): diff -r 98f69895a4dc -r a8604735c04b suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py Fri Aug 08 11:01:29 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/07_DeleteResourcePool.py Mon Aug 11 23:01:14 2008 -0700 @@ -43,6 +43,7 @@ import sys import pywbem +from VirtLib import utils from XenKvmLib import rpcs_service from CimTest.Globals import logger from CimTest.ReturnCodes import FAIL, PASS @@ -50,7 +51,6 @@ from XenKvmLib.classes import get_typed_class cim_errno = pywbem.CIM_ERR_NOT_SUPPORTED -cim_desc = "CIM_ERR_NOT_SUPPORTED" cim_mname = "DeleteResourcePool" @do_main(platform_sup) @@ -58,6 +58,13 @@ options = main.options rpcs_conn = eval("rpcs_service." + get_typed_class(options.virt, \ "ResourcePoolConfigurationService"))(options.ip) + cmd = "lsof -P -i:5988 | grep sfcbd" + rc, out = utils.run_remote(options.ip, cmd) + if rc == 0: + cim_desc = "The requested operation is not supported" + else: + cim_desc = "CIM_ERR_NOT_SUPPORTED" + try: rpcs_conn.DeleteResourcePool() except pywbem.CIMError, (err_no, desc):

GY> + cmd = "lsof -P -i:5988 | grep sfcbd" GY> + rc, out = utils.run_remote(options.ip, cmd) GY> + if rc == 0: GY> + cim_desc = "The requested operation is not supported" GY> + else: GY> + cim_desc = "CIM_ERR_NOT_SUPPORTED" -1. Just have a list of the two valid error codes and check that it's one of the two: msgs = ["The requested operation is not supported", "CIM_ERR_NOT_SUPPORTED"] if errmsg not in msgs: # FAIL However, it seems to me like this particular case should be handled by checking the error code. We should fix the return values instead of this hack. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
GY> + cmd = "lsof -P -i:5988 | grep sfcbd" GY> + rc, out = utils.run_remote(options.ip, cmd) GY> + if rc == 0: GY> + cim_desc = "The requested operation is not supported" GY> + else: GY> + cim_desc = "CIM_ERR_NOT_SUPPORTED"
-1.
Just have a list of the two valid error codes and check that it's one of the two:
msgs = ["The requested operation is not supported", "CIM_ERR_NOT_SUPPORTED"] if errmsg not in msgs: # FAIL
However, it seems to me like this particular case should be handled by checking the error code. We should fix the return values instead of this hack.
The providers are returning the proper values for these calls. The difference between Pegasus and SFCB in this case is that Pegasus returns "CIM_ERR_NOT_SUPPORTED" as the error description and SFCB returns "The requested operation is not supported". Daisy, in this case, the error returned by both is CIM_ERR_NOT_SUPPORTED (which is equal to 7). Since this error is specific, I think it's fine to just check the error number. There's no need to check the error description. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Dan Smith
-
Kaitlin Rupert
-
yunguol@cn.ibm.com