From: Victor Stinner Date: Sun, 8 Nov 2015 20:49:09 +0000 (+0100) Subject: py3: Fix error handling in prophetstor driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2ff3f0be12cfe18d264fa14905011068069585cf;p=openstack-build%2Fcinder-build.git py3: Fix error handling in prophetstor driver * Port prophetstor driver to Python 3 * Replace "except exception as e:" with "except Exception as e:" to handle "Fexvisor failed to join the volume ..." and "Fexvisor failed to remove the volume ..." errors. Here, lower case "exception" is the cinder.exception module, not an exception class. On Python 3, "except" requires exception classes. * tests-py3.txt: add cinder.tests.unit.test_prophetstor_dpl Partial-Implements: blueprint cinder-python3 Change-Id: I0447b62cc0afe5a10ecbc888dfb6608b69f977d2 --- diff --git a/cinder/volume/drivers/prophetstor/dplcommon.py b/cinder/volume/drivers/prophetstor/dplcommon.py index 8fa790ab6..8c5b3788c 100644 --- a/cinder/volume/drivers/prophetstor/dplcommon.py +++ b/cinder/volume/drivers/prophetstor/dplcommon.py @@ -993,7 +993,7 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD, if self._conver_uuid2hex(vid) in group_members: continue self._join_volume_group(volume, cgid) - except exception as e: + except Exception as e: msg = _("Fexvisor failed to join the volume %(vol)s in the " "group %(group)s due to " "%(ret)s.") % {"vol": vid, "group": cgid, @@ -1005,7 +1005,7 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD, vid = volume['id'] if self._conver_uuid2hex(vid) in group_members: self._leave_volume_group(volume, cgid) - except exception as e: + except Exception as e: msg = _("Fexvisor failed to remove the volume %(vol)s in the " "group %(group)s due to " "%(ret)s.") % {"vol": vid, "group": cgid, diff --git a/tests-py3.txt b/tests-py3.txt index a1ab4b57c..268602b0b 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -86,6 +86,7 @@ cinder.tests.unit.test_netapp_nfs cinder.tests.unit.test_netapp_ssc cinder.tests.unit.test_nfs cinder.tests.unit.test_nimble +cinder.tests.unit.test_prophetstor_dpl cinder.tests.unit.test_pure cinder.tests.unit.test_qos_specs cinder.tests.unit.test_quobyte