move storpool exception

This patch moves the storpool driver exception to the driver.

Change-Id: Ifa04e1f8f9e09c83a6bed16daecda51863ea3bcb
This commit is contained in:
Walter A. Boring IV 2019-05-08 18:57:53 +00:00
parent 56d56f09b1
commit d67105c7f4
3 changed files with 8 additions and 9 deletions

View File

@ -1100,12 +1100,6 @@ class BadResetResourceStatus(CinderException):
message = _("Bad reset resource status : %(reason)s")
# StorPool driver
class StorPoolConfigurationInvalid(CinderException):
message = _("Invalid parameter %(param)s in the %(section)s section "
"of the /etc/storpool.conf file: %(error)s")
# DOTHILL drivers
class DotHillInvalidBackend(VolumeDriverException):
message = _("Backend doesn't exist (%(backend)s)")

View File

@ -192,7 +192,7 @@ class StorPoolTestCase(test.TestCase):
@ddt.data(
(5, TypeError),
({'no-host': None}, KeyError),
({'host': 'sbad'}, exception.StorPoolConfigurationInvalid),
({'host': 'sbad'}, driver.StorPoolConfigurationInvalid),
({'host': 's01'}, None),
({'host': 'none'}, None),
)
@ -208,7 +208,7 @@ class StorPoolTestCase(test.TestCase):
@ddt.data(
(5, TypeError),
({'no-host': None}, KeyError),
({'host': 'sbad'}, exception.StorPoolConfigurationInvalid),
({'host': 'sbad'}, driver.StorPoolConfigurationInvalid),
)
@ddt.unpack
def test_initialize_connection_bad(self, conn, exc):

View File

@ -57,6 +57,11 @@ CONF = cfg.CONF
CONF.register_opts(storpool_opts)
class StorPoolConfigurationInvalid(exception.CinderException):
message = _("Invalid parameter %(param)s in the %(section)s section "
"of the /etc/storpool.conf file: %(error)s")
@interface.volumedriver
class StorPoolDriver(driver.VolumeDriver):
"""The StorPool block device driver.
@ -152,7 +157,7 @@ class StorPoolDriver(driver.VolumeDriver):
except KeyError:
return 65
except Exception as e:
raise exception.StorPoolConfigurationInvalid(
raise StorPoolConfigurationInvalid(
section=hostname, param='SP_OURID', error=e)
def validate_connector(self, connector):