Fix callback method interface to remove warning by tenacity
Since tenacity 5.0.0[1], the following deprecation warning is shown if
the function used for retry_error_callback doesn't accept single
"retry_state" parameter.
DeprecationWarning: "retry_error_callback" function must accept single
"retry_state" parameter, please update <function name>
This fixes the _raise_compute_exception method causing that warning
at this moment.
[1] 846d8c8449
Change-Id: If4abc9b5567e18820377cab21dcad62cbe4cdc92
This commit is contained in:
parent
76e731ad73
commit
fbcb8423ea
|
@ -32,6 +32,11 @@ LOG = logging.getLogger(__name__)
|
|||
CONF = cfg.CONF
|
||||
|
||||
|
||||
def _raise_compute_exception(retry_state):
|
||||
LOG.exception("Error retrieving nova virtual machine.")
|
||||
raise exceptions.ComputeGetException()
|
||||
|
||||
|
||||
class VirtualMachineManager(compute_base.ComputeBase):
|
||||
'''Compute implementation of virtual machines via nova.'''
|
||||
|
||||
|
@ -180,10 +185,6 @@ class VirtualMachineManager(compute_base.ComputeBase):
|
|||
raise exceptions.ComputeStatusException() from e
|
||||
return constants.DOWN
|
||||
|
||||
def _raise_compute_exception(self):
|
||||
LOG.exception("Error retrieving nova virtual machine.")
|
||||
raise exceptions.ComputeGetException()
|
||||
|
||||
@tenacity.retry(retry=tenacity.retry_if_exception_type(),
|
||||
stop=tenacity.stop_after_attempt(CONF.compute.max_retries),
|
||||
retry_error_callback=_raise_compute_exception,
|
||||
|
|
Loading…
Reference in New Issue