GPFS: Handle unsupported operations with an exception

This patch adds a support to fail the unsupported CG operations
for GPFS driver with GPFSDriverUnsupportedOperation exception.

Change-Id: Icd5a693ac75eca0f55cc3ecb014feb192e9e84d7
Closes-bug: #1691526
(cherry picked from commit 77d17a1f8b)
This commit is contained in:
Gaurang Tapase 2017-05-22 15:35:16 -04:00 committed by digvijay2016
parent 8eda0ba793
commit bccd77a600
3 changed files with 32 additions and 0 deletions

View File

@ -1359,3 +1359,8 @@ class AttachmentSpecsNotFound(NotFound):
class InvalidAttachment(Invalid):
message = _("Invalid attachment: %(reason)s")
# GPFS driver
class GPFSDriverUnsupportedOperation(VolumeBackendAPIException):
message = _("GPFS driver unsupported operation: %(msg)s")

View File

@ -1686,6 +1686,19 @@ class GPFSDriverTestCase(test.TestCase):
self.assertRaises(exception.VolumeBackendAPIException,
self.driver.delete_consistencygroup, ctxt, group, [])
def test_update_consistencygroup(self):
ctxt = self.context
group = self._fake_group()
self.assertRaises(exception.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.driver.create_consistencygroup_from_src,
ctxt, group, [])
@mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.create_snapshot')
def test_create_cgsnapshot(self, mock_create_snap):
ctxt = self.context

View File

@ -1235,6 +1235,20 @@ class GPFSDriver(driver.CloneableImageVD,
return model_update, snapshots_model_update
def update_consistencygroup(self, context, group,
add_volumes=None, remove_volumes=None):
msg = _('Updating a consistency group is not supported.')
LOG.error(msg)
raise exception.GPFSDriverUnsupportedOperation(msg=msg)
def create_consistencygroup_from_src(self, context, group, volumes,
cgsnapshot=None, snapshots=None,
source_cg=None, source_vols=None):
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)
@interface.volumedriver
class GPFSNFSDriver(GPFSDriver, nfs.NfsDriver, san.SanDriver):