move GPFS driver exception to driver file

This patch moves the GPFS specific driver exception to
the driver file itself.

Change-Id: I25e4a9abb351b208b4efac1b0fa5b77101f74ff6
This commit is contained in:
Walter A. Boring IV 2019-05-03 16:18:28 +00:00
parent 6fcb7c6639
commit e049afa652
3 changed files with 8 additions and 9 deletions

View File

@ -1367,11 +1367,6 @@ class ErrorInHyperScaleVersion(VolumeDriverException):
message = _("Error in getting HyperScale version '%(cmd_error)s'")
# GPFS driver
class GPFSDriverUnsupportedOperation(VolumeBackendAPIException):
message = _("GPFS driver unsupported operation: %(msg)s")
class InvalidName(Invalid):
message = _("An invalid 'name' value was provided. %(reason)s")

View File

@ -1668,13 +1668,13 @@ class GPFSDriverTestCase(test.TestCase):
def test_update_consistencygroup(self):
ctxt = self.context
group = self._fake_group()
self.assertRaises(exception.GPFSDriverUnsupportedOperation,
self.assertRaises(gpfs.GPFSDriverUnsupportedOperation,
self.driver._update_consistencygroup, ctxt, group)
def test_create_consisgroup_from_src(self):
ctxt = self.context
group = self._fake_group()
self.assertRaises(exception.GPFSDriverUnsupportedOperation,
self.assertRaises(gpfs.GPFSDriverUnsupportedOperation,
self.driver._create_consistencygroup_from_src,
ctxt, group, [])

View File

@ -121,6 +121,10 @@ CONF.register_opts(gpfs_opts, group=configuration.SHARED_CONF_GROUP)
CONF.register_opts(gpfs_remote_ssh_opts, group=configuration.SHARED_CONF_GROUP)
class GPFSDriverUnsupportedOperation(exception.VolumeBackendAPIException):
message = _("GPFS driver unsupported operation: %(msg)s")
def _different(difference_tuple):
"""Return true if two elements of a tuple are different."""
if difference_tuple:
@ -1268,7 +1272,7 @@ class GPFSDriver(driver.CloneableImageVD,
add_volumes=None, remove_volumes=None):
msg = _('Updating a consistency group is not supported.')
LOG.error(msg)
raise exception.GPFSDriverUnsupportedOperation(msg=msg)
raise GPFSDriverUnsupportedOperation(msg=msg)
def _create_consistencygroup_from_src(self, context, group, volumes,
cgsnapshot=None, snapshots=None,
@ -1276,7 +1280,7 @@ class GPFSDriver(driver.CloneableImageVD,
msg = _('Creating a consistency group from any source consistency '
'group or consistency group snapshot is not supported.')
LOG.error(msg)
raise exception.GPFSDriverUnsupportedOperation(msg=msg)
raise GPFSDriverUnsupportedOperation(msg=msg)
def create_group(self, ctxt, group):
"""Creates a group.