Merge "move Dell EMC SC driver exceptions"

This commit is contained in:
Zuul 2019-05-29 16:19:01 +00:00 committed by Gerrit Code Review
commit f4d0b062d7
3 changed files with 8 additions and 13 deletions

View File

@ -948,16 +948,6 @@ class VolumeDeviceNotFound(CinderException):
message = _('Volume device not found at %(device)s.')
# Driver specific exceptions
# Dell
class DellDriverRetryableException(VolumeBackendAPIException):
message = _("Retryable Dell Exception encountered")
class DellDriverUnknownSpec(VolumeDriverException):
message = _("Dell driver failure: %(reason)s")
# RemoteFS drivers
class RemoteFSException(VolumeDriverException):
message = _("Unknown RemoteFS exception")

View File

@ -8954,7 +8954,8 @@ class DellHttpClientTestCase(test.TestCase):
'get')
def test_wait_for_async_complete_get_raises(self,
mock_get):
mock_get.side_effect = (exception.DellDriverRetryableException())
mock_get.side_effect = (
storagecenter_api.DellDriverRetryableException())
self.assertRaises(exception.VolumeBackendAPIException,
self.httpclient._wait_for_async_complete,
self.ASYNCTASK)

View File

@ -31,6 +31,10 @@ from cinder import utils
LOG = logging.getLogger(__name__)
class DellDriverRetryableException(exception.VolumeBackendAPIException):
message = _("Retryable Dell Exception encountered")
class PayloadFilter(object):
"""PayloadFilter
@ -229,7 +233,7 @@ class HttpClient(object):
return rest_response
@utils.retry(exceptions=(requests.ConnectionError,
exception.DellDriverRetryableException))
DellDriverRetryableException))
def get(self, url):
LOG.debug('get: %(url)s', {'url': url})
rest_response = self.session.get(self.__formatUrl(url),
@ -240,7 +244,7 @@ class HttpClient(object):
if (rest_response and rest_response.status_code == (
http_client.BAD_REQUEST)) and (
'Unhandled Exception' in rest_response.text):
raise exception.DellDriverRetryableException()
raise DellDriverRetryableException()
return rest_response
@utils.retry(exceptions=(requests.ConnectionError,))