Remove 'message' from format argument from exception
This patch removes 'message' from format argument of 'NexentaException' and 'BadResetResourceStatus' exceptions. We should not use 'message' as a format argument and the reason is described here [1]. From a long time view we need remove them from exceptions rather than remove it when initialized. [1]: https://review.openstack.org/#/c/572674/ Change-Id: Icc0e4aefecbd224a4c14bdaef64b62ec0cd68968
This commit is contained in:
parent
1aa9231cb2
commit
38950b71e4
@ -1178,7 +1178,7 @@ class BadHTTPResponseStatus(VolumeDriverException):
|
||||
|
||||
|
||||
class BadResetResourceStatus(CinderException):
|
||||
message = _("Bad reset resource status : %(message)s")
|
||||
message = _("Bad reset resource status : %(reason)s")
|
||||
|
||||
|
||||
# ZADARA STORAGE VPSA driver exception
|
||||
@ -1285,7 +1285,7 @@ class NotSupportedOperation(Invalid):
|
||||
|
||||
# NexentaStor driver exception
|
||||
class NexentaException(VolumeDriverException):
|
||||
message = "%(message)s"
|
||||
message = "%(reason)s"
|
||||
|
||||
|
||||
# Google Cloud Storage(GCS) backup driver
|
||||
|
@ -480,7 +480,8 @@ class TestNexentaNfsDriver(test.TestCase):
|
||||
mock_chmod.assert_called_with(
|
||||
'chmod ugo+rw /volumes/stack/share/volume-1/volume')
|
||||
mock_truncate = self.nms_mock.appliance.execute
|
||||
mock_truncate.side_effect = exception.NexentaException()
|
||||
mock_truncate.side_effect = exception.NexentaException(
|
||||
'fake_exception')
|
||||
self.nms_mock.server.get_prop.return_value = '/volumes'
|
||||
self.nms_mock.folder.get_child_props.return_value = {
|
||||
'available': 1, 'used': 1}
|
||||
|
@ -118,7 +118,8 @@ class TestNexentaISCSIDriver(test.TestCase):
|
||||
self.assertRaises(
|
||||
exception.NexentaException, self.drv.check_for_setup_error)
|
||||
|
||||
self.nef_mock.get.side_effect = exception.NexentaException()
|
||||
self.nef_mock.get.side_effect = exception.NexentaException(
|
||||
'fake_exception')
|
||||
self.assertRaises(LookupError, self.drv.check_for_setup_error)
|
||||
|
||||
def test_create_volume(self):
|
||||
@ -169,8 +170,8 @@ class TestNexentaISCSIDriver(test.TestCase):
|
||||
self._create_volume_db_entry()
|
||||
vol = self.TEST_VOLUME_REF2
|
||||
src_vref = self.TEST_VOLUME_REF
|
||||
crt_vol.side_effect = exception.NexentaException()
|
||||
dlt_snap.side_effect = exception.NexentaException()
|
||||
crt_vol.side_effect = exception.NexentaException('fake_exception')
|
||||
dlt_snap.side_effect = exception.NexentaException('fake_exception')
|
||||
self.assertRaises(
|
||||
exception.NexentaException,
|
||||
self.drv.create_cloned_volume, vol, src_vref)
|
||||
|
@ -1018,7 +1018,7 @@ class VolumeManager(manager.CleanableManager,
|
||||
msg = _("Revert finished, but failed to reset "
|
||||
"volume %(id)s status to %(status)s, "
|
||||
"please manually reset it.") % msg_args
|
||||
raise exception.BadResetResourceStatus(message=msg)
|
||||
raise exception.BadResetResourceStatus(reason=msg)
|
||||
|
||||
s_res = snapshot.update_single_status_where(
|
||||
fields.SnapshotStatus.AVAILABLE,
|
||||
@ -1030,7 +1030,7 @@ class VolumeManager(manager.CleanableManager,
|
||||
msg = _("Revert finished, but failed to reset "
|
||||
"snapshot %(id)s status to %(status)s, "
|
||||
"please manually reset it.") % msg_args
|
||||
raise exception.BadResetResourceStatus(message=msg)
|
||||
raise exception.BadResetResourceStatus(reason=msg)
|
||||
if backup_snapshot:
|
||||
self.delete_snapshot(context,
|
||||
backup_snapshot, handle_quota=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user