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

This commit is contained in:
Zuul 2018-06-26 05:15:55 +00:00 committed by Gerrit Code Review
commit fc19a0dca8
3 changed files with 11 additions and 11 deletions

View File

@ -1334,7 +1334,7 @@ class InvalidAttachment(Invalid):
# Veritas driver # Veritas driver
class UnableToExecuteHyperScaleCmd(VolumeDriverException): class UnableToExecuteHyperScaleCmd(VolumeDriverException):
message = _("Failed HyperScale command for '%(message)s'") message = _("Failed HyperScale command for '%(command)s'")
class UnableToProcessHyperScaleCmdOutput(VolumeDriverException): class UnableToProcessHyperScaleCmdOutput(VolumeDriverException):

View File

@ -341,7 +341,7 @@ class VRTSHyperScaleDriverTestCase(test.TestCase):
vol_a = _stub_volume() vol_a = _stub_volume()
vol_b = _stub_volume() vol_b = _stub_volume()
mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd( mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd(
cmd_out='mock error') command='mock error')
self.assertRaises(exception.UnableToExecuteHyperScaleCmd, self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
self.driver.create_cloned_volume, vol_b, vol_a) self.driver.create_cloned_volume, vol_b, vol_a)
@ -411,7 +411,7 @@ class VRTSHyperScaleDriverTestCase(test.TestCase):
"""Test case create volume from snapshot thorws exception.""" """Test case create volume from snapshot thorws exception."""
fake_volume, fake_snapshot = _stub_volume(), _stub_snapshot() fake_volume, fake_snapshot = _stub_volume(), _stub_snapshot()
mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd( mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd(
cmd_out='mock error') command='mock error')
self.assertRaises(exception.UnableToExecuteHyperScaleCmd, self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
self.driver.create_volume_from_snapshot, fake_volume, self.driver.create_volume_from_snapshot, fake_volume,
fake_snapshot) fake_snapshot)
@ -485,7 +485,7 @@ class VRTSHyperScaleDriverTestCase(test.TestCase):
mock_es_obj = {'payload': {'update': False}} mock_es_obj = {'payload': {'update': False}}
mock_es.return_value = mock_es_obj mock_es.return_value = mock_es_obj
mock_mcp.side_effect = exception.UnableToExecuteHyperScaleCmd( mock_mcp.side_effect = exception.UnableToExecuteHyperScaleCmd(
cmd_out='mock error') command='mock error')
fake_snapshot = _stub_snapshot() fake_snapshot = _stub_snapshot()
self.assertRaises(exception.UnableToExecuteHyperScaleCmd, self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
self.driver.create_snapshot, fake_snapshot) self.driver.create_snapshot, fake_snapshot)

View File

@ -73,7 +73,7 @@ def get_hyperscale_version():
exception.UnableToProcessHyperScaleCmdOutput): exception.UnableToProcessHyperScaleCmdOutput):
LOG.error("Exception in running the command for version", LOG.error("Exception in running the command for version",
exc_info=True) exc_info=True)
raise exception.UnableToExecuteHyperScaleCmd(message="version") raise exception.UnableToExecuteHyperScaleCmd(command="version")
return version return version
@ -99,7 +99,7 @@ def get_datanode_id():
LOG.error("Error %s in getting datanode hypervisor id", LOG.error("Error %s in getting datanode hypervisor id",
cmd_err) cmd_err)
raise exception.UnableToExecuteHyperScaleCmd( raise exception.UnableToExecuteHyperScaleCmd(
message=cmdarg_json) command=cmdarg_json)
except exception.UnableToExecuteHyperScaleCmd: except exception.UnableToExecuteHyperScaleCmd:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.debug("Unable to execute get_datanode_id", exc_info=True) LOG.debug("Unable to execute get_datanode_id", exc_info=True)
@ -134,7 +134,7 @@ def episodic_snap(meta):
LOG.error("Error %s in processing episodic_snap", LOG.error("Error %s in processing episodic_snap",
cmd_err) cmd_err)
raise exception.UnableToExecuteHyperScaleCmd( raise exception.UnableToExecuteHyperScaleCmd(
message=cmdarg_json) command=cmdarg_json)
except exception.UnableToExecuteHyperScaleCmd: except exception.UnableToExecuteHyperScaleCmd:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.debug("Unable to execute episodic_snap", exc_info=True) LOG.debug("Unable to execute episodic_snap", exc_info=True)
@ -172,7 +172,7 @@ def get_image_path(image_id, op_type='image'):
LOG.error("Error %s in processing get_image_path", LOG.error("Error %s in processing get_image_path",
cmd_err) cmd_err)
raise exception.UnableToExecuteHyperScaleCmd( raise exception.UnableToExecuteHyperScaleCmd(
message=cmdarg_json) command=cmdarg_json)
except exception.UnableToExecuteHyperScaleCmd: except exception.UnableToExecuteHyperScaleCmd:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.debug("Unable to execute get_image_path", exc_info=True) LOG.debug("Unable to execute get_image_path", exc_info=True)
@ -206,7 +206,7 @@ def update_image(image_path, volume_id, hs_img_id):
LOG.error("Error %s in execution of update_image", LOG.error("Error %s in execution of update_image",
cmd_err) cmd_err)
raise exception.UnableToExecuteHyperScaleCmd( raise exception.UnableToExecuteHyperScaleCmd(
message=cmdarg_json) command=cmdarg_json)
except exception.UnableToExecuteHyperScaleCmd: except exception.UnableToExecuteHyperScaleCmd:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.debug("Unable to execute update_image", exc_info=True) LOG.debug("Unable to execute update_image", exc_info=True)
@ -232,12 +232,12 @@ def hsexecute(cmdarg_json):
LOG.error("Exception in running the command for %s", LOG.error("Exception in running the command for %s",
cmdarg_json, cmdarg_json,
exc_info=True) exc_info=True)
raise exception.UnableToExecuteHyperScaleCmd(message=cmdarg_json) raise exception.UnableToExecuteHyperScaleCmd(command=cmdarg_json)
except Exception: except Exception:
LOG.error("Internal exception in cmd for %s", cmdarg_json, LOG.error("Internal exception in cmd for %s", cmdarg_json,
exc_info=True) exc_info=True)
raise exception.UnableToExecuteHyperScaleCmd(message=cmdarg_json) raise exception.UnableToExecuteHyperScaleCmd(command=cmdarg_json)
return (cmd_out, cmd_err) return (cmd_out, cmd_err)