Remove 'message' from format argument from exception
This patch removes 'message' from format argument of 'UnableToExecuteHyperScaleCmd' exception. 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: I9eb27adcd7880029a133c3657bbae67a0bc21a74
This commit is contained in:
parent
b229a9aded
commit
833e47f5a7
@ -1334,7 +1334,7 @@ class InvalidAttachment(Invalid):
|
||||
|
||||
# Veritas driver
|
||||
class UnableToExecuteHyperScaleCmd(VolumeDriverException):
|
||||
message = _("Failed HyperScale command for '%(message)s'")
|
||||
message = _("Failed HyperScale command for '%(command)s'")
|
||||
|
||||
|
||||
class UnableToProcessHyperScaleCmdOutput(VolumeDriverException):
|
||||
|
@ -341,7 +341,7 @@ class VRTSHyperScaleDriverTestCase(test.TestCase):
|
||||
vol_a = _stub_volume()
|
||||
vol_b = _stub_volume()
|
||||
mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd(
|
||||
cmd_out='mock error')
|
||||
command='mock error')
|
||||
self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
|
||||
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."""
|
||||
fake_volume, fake_snapshot = _stub_volume(), _stub_snapshot()
|
||||
mock_mdp.side_effect = exception.UnableToExecuteHyperScaleCmd(
|
||||
cmd_out='mock error')
|
||||
command='mock error')
|
||||
self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
|
||||
self.driver.create_volume_from_snapshot, fake_volume,
|
||||
fake_snapshot)
|
||||
@ -485,7 +485,7 @@ class VRTSHyperScaleDriverTestCase(test.TestCase):
|
||||
mock_es_obj = {'payload': {'update': False}}
|
||||
mock_es.return_value = mock_es_obj
|
||||
mock_mcp.side_effect = exception.UnableToExecuteHyperScaleCmd(
|
||||
cmd_out='mock error')
|
||||
command='mock error')
|
||||
fake_snapshot = _stub_snapshot()
|
||||
self.assertRaises(exception.UnableToExecuteHyperScaleCmd,
|
||||
self.driver.create_snapshot, fake_snapshot)
|
||||
|
@ -73,7 +73,7 @@ def get_hyperscale_version():
|
||||
exception.UnableToProcessHyperScaleCmdOutput):
|
||||
LOG.error("Exception in running the command for version",
|
||||
exc_info=True)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(message="version")
|
||||
raise exception.UnableToExecuteHyperScaleCmd(command="version")
|
||||
|
||||
return version
|
||||
|
||||
@ -99,7 +99,7 @@ def get_datanode_id():
|
||||
LOG.error("Error %s in getting datanode hypervisor id",
|
||||
cmd_err)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(
|
||||
message=cmdarg_json)
|
||||
command=cmdarg_json)
|
||||
except exception.UnableToExecuteHyperScaleCmd:
|
||||
with excutils.save_and_reraise_exception():
|
||||
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",
|
||||
cmd_err)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(
|
||||
message=cmdarg_json)
|
||||
command=cmdarg_json)
|
||||
except exception.UnableToExecuteHyperScaleCmd:
|
||||
with excutils.save_and_reraise_exception():
|
||||
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",
|
||||
cmd_err)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(
|
||||
message=cmdarg_json)
|
||||
command=cmdarg_json)
|
||||
except exception.UnableToExecuteHyperScaleCmd:
|
||||
with excutils.save_and_reraise_exception():
|
||||
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",
|
||||
cmd_err)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(
|
||||
message=cmdarg_json)
|
||||
command=cmdarg_json)
|
||||
except exception.UnableToExecuteHyperScaleCmd:
|
||||
with excutils.save_and_reraise_exception():
|
||||
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",
|
||||
cmdarg_json,
|
||||
exc_info=True)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(message=cmdarg_json)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(command=cmdarg_json)
|
||||
|
||||
except Exception:
|
||||
LOG.error("Internal exception in cmd for %s", cmdarg_json,
|
||||
exc_info=True)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(message=cmdarg_json)
|
||||
raise exception.UnableToExecuteHyperScaleCmd(command=cmdarg_json)
|
||||
|
||||
return (cmd_out, cmd_err)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user