Merge "Remove 'message' from format argument from exception"

This commit is contained in:
Zuul 2018-06-26 05:15:53 +00:00 committed by Gerrit Code Review
commit 090a08fc33
4 changed files with 10 additions and 8 deletions

View File

@ -1178,7 +1178,7 @@ class BadHTTPResponseStatus(VolumeDriverException):
class BadResetResourceStatus(CinderException): class BadResetResourceStatus(CinderException):
message = _("Bad reset resource status : %(message)s") message = _("Bad reset resource status : %(reason)s")
# ZADARA STORAGE VPSA driver exception # ZADARA STORAGE VPSA driver exception
@ -1285,7 +1285,7 @@ class NotSupportedOperation(Invalid):
# NexentaStor driver exception # NexentaStor driver exception
class NexentaException(VolumeDriverException): class NexentaException(VolumeDriverException):
message = "%(message)s" message = "%(reason)s"
# Google Cloud Storage(GCS) backup driver # Google Cloud Storage(GCS) backup driver

View File

@ -480,7 +480,8 @@ class TestNexentaNfsDriver(test.TestCase):
mock_chmod.assert_called_with( mock_chmod.assert_called_with(
'chmod ugo+rw /volumes/stack/share/volume-1/volume') 'chmod ugo+rw /volumes/stack/share/volume-1/volume')
mock_truncate = self.nms_mock.appliance.execute 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.server.get_prop.return_value = '/volumes'
self.nms_mock.folder.get_child_props.return_value = { self.nms_mock.folder.get_child_props.return_value = {
'available': 1, 'used': 1} 'available': 1, 'used': 1}

View File

@ -118,7 +118,8 @@ class TestNexentaISCSIDriver(test.TestCase):
self.assertRaises( self.assertRaises(
exception.NexentaException, self.drv.check_for_setup_error) 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) self.assertRaises(LookupError, self.drv.check_for_setup_error)
def test_create_volume(self): def test_create_volume(self):
@ -169,8 +170,8 @@ class TestNexentaISCSIDriver(test.TestCase):
self._create_volume_db_entry() self._create_volume_db_entry()
vol = self.TEST_VOLUME_REF2 vol = self.TEST_VOLUME_REF2
src_vref = self.TEST_VOLUME_REF src_vref = self.TEST_VOLUME_REF
crt_vol.side_effect = exception.NexentaException() crt_vol.side_effect = exception.NexentaException('fake_exception')
dlt_snap.side_effect = exception.NexentaException() dlt_snap.side_effect = exception.NexentaException('fake_exception')
self.assertRaises( self.assertRaises(
exception.NexentaException, exception.NexentaException,
self.drv.create_cloned_volume, vol, src_vref) self.drv.create_cloned_volume, vol, src_vref)

View File

@ -1018,7 +1018,7 @@ class VolumeManager(manager.CleanableManager,
msg = _("Revert finished, but failed to reset " msg = _("Revert finished, but failed to reset "
"volume %(id)s status to %(status)s, " "volume %(id)s status to %(status)s, "
"please manually reset it.") % msg_args "please manually reset it.") % msg_args
raise exception.BadResetResourceStatus(message=msg) raise exception.BadResetResourceStatus(reason=msg)
s_res = snapshot.update_single_status_where( s_res = snapshot.update_single_status_where(
fields.SnapshotStatus.AVAILABLE, fields.SnapshotStatus.AVAILABLE,
@ -1030,7 +1030,7 @@ class VolumeManager(manager.CleanableManager,
msg = _("Revert finished, but failed to reset " msg = _("Revert finished, but failed to reset "
"snapshot %(id)s status to %(status)s, " "snapshot %(id)s status to %(status)s, "
"please manually reset it.") % msg_args "please manually reset it.") % msg_args
raise exception.BadResetResourceStatus(message=msg) raise exception.BadResetResourceStatus(reason=msg)
if backup_snapshot: if backup_snapshot:
self.delete_snapshot(context, self.delete_snapshot(context,
backup_snapshot, handle_quota=False) backup_snapshot, handle_quota=False)