move Dell EMC SC driver exceptions

This patch moves the Dell EMC SC exceptions to the driver.

Change-Id: I83ab1925dd7eb39cf64b9853cd65e2b7cb06e833
This commit is contained in:
Walter A. Boring IV 2019-05-24 13:22:09 +00:00
parent cf2a85629e
commit 30da697a59
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,))