On 09/15/2011 05:35 PM, Wayne Sun wrote:
--- cases/basic_nodedevice.conf | 2 +- lib/nodedevAPI.py | 2 +- lib/storageAPI.py | 2 +- repos/nodedevice/detach.py | 22 +++++++++++----------- repos/storage/define_scsi_pool.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cases/basic_nodedevice.conf b/cases/basic_nodedevice.conf index cea431e..85a68f7 100644 --- a/cases/basic_nodedevice.conf +++ b/cases/basic_nodedevice.conf @@ -1,4 +1,4 @@ -nodedevice:dettach +nodedevice:detach pciaddress $testpci diff --git a/lib/nodedevAPI.py b/lib/nodedevAPI.py index 8d588c4..cc96909 100644 --- a/lib/nodedevAPI.py +++ b/lib/nodedevAPI.py @@ -185,7 +185,7 @@ class NodedevAPI: code = e.get_error_code() raise exception.LibvirtAPI(message, code) - def connect(self, name) + def connect(self, name): try: obj = self.lookup_by_name(name) return obj.connect() diff --git a/lib/storageAPI.py b/lib/storageAPI.py index 2d75a0b..6c9d286 100644 --- a/lib/storageAPI.py +++ b/lib/storageAPI.py @@ -231,7 +231,7 @@ class StorageAPI(object): code = e.get_error_code() raise exception.LibvirtAPI(message, code) - def delete_pool(self, poolname, flags = 1): + def delete_pool(self, poolname, flags = 0): try: pool_obj = self.get_pool_obj(poolname) return pool_obj.delete(flags) diff --git a/repos/nodedevice/detach.py b/repos/nodedevice/detach.py index ac9aa89..18e792e 100644 --- a/repos/nodedevice/detach.py +++ b/repos/nodedevice/detach.py @@ -1,13 +1,13 @@ #!/usr/bin/env python """this test case is used for testing - dettach a specific node device + detach a specific node device """ __author__ = 'Alex Jia: ajia@xxxxxxxxxx' __date__ = 'Tue Apr 6, 2010' __version__ = '0.1.0' __credits__ = 'Copyright (C) 2009 Red Hat, Inc.' -__all__ = ['usage', 'check_node_dettach', 'dettach'] +__all__ = ['usage', 'check_node_detach', 'detach'] import os @@ -45,8 +45,8 @@ def usage(params): else: pass -def check_node_dettach(pciaddress): - """Check node device dettach result, if dettachment is successful, the +def check_node_detach(pciaddress): + """Check node device detach result, if detachment is successful, the device host driver should be hided and the device should be bound to pci-stub driver, argument 'address' is a address of the node device """ @@ -64,7 +64,7 @@ def check_node_dettach(pciaddress): driver = os.path.basename(retval) return driver -def dettach(dicts): +def detach(dicts): """Dettach a specific node device and bind it to pci-stub driver, argument 'dicts' is a dictionary type and includes 'pciaddress' key, whose value uniquely identify a pci address of the node device @@ -78,7 +78,7 @@ def dettach(dicts): pciaddress = dicts['pciaddress'] - original_driver = check_node_dettach(pciaddress) + original_driver = check_node_detach(pciaddress) logger.info("original device driver: %s" % original_driver) util = utils.Utils() @@ -120,22 +120,22 @@ def dettach(dicts): try: try: - logger.info("dettach the node device") + logger.info("detach the node device") nodeobj.dettach(device_name) - current_driver = check_node_dettach(pciaddress) + current_driver = check_node_detach(pciaddress) logger.info("current device driver: %s" % current_driver) if current_driver != original_driver and current_driver == pciback: - logger.info("the node %s device dettach is successful" \ + logger.info("the node %s device detach is successful" \ % device_name) test_result = True else: - logger.info("the node %s device dettach is failed" % device_name) + logger.info("the node %s device detach is failed" % device_name) test_result = False return 1 except LibvirtAPI, e: logger.error("API error message: %s, error code is %s" \ % (e.response()['message'], e.response()['code'])) - logger.error("Error: fail to dettach %s node device" % device_name) + logger.error("Error: fail to detach %s node device" % device_name) test_result = False return 1 finally: diff --git a/repos/storage/define_scsi_pool.py b/repos/storage/define_scsi_pool.py index a5193e2..6afbe01 100644 --- a/repos/storage/define_scsi_pool.py +++ b/repos/storage/define_scsi_pool.py @@ -140,7 +140,7 @@ def define_scsi_pool(params): logger.error("API error message: %s, error code is %s" \ % (e.response()['message'], e.response()['code'])) return 1 - finally + finally: conn.close() logger.info("closed hypervisor connection")
ACK and pushed Guannan Ren -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list