From 2f5885e4bf78d60ca636e29bcc02a0e4b02d33b8 Mon Sep 17 00:00:00 2001 From: venkatakrishnathumu Date: Wed, 2 Dec 2020 15:18:27 +0000 Subject: [PATCH] [SVF]: Fixed host and group failback issues [Spectrum Virtualize Family] Fixed issue regarding failback of a cinder host and a group that impacts IBM Spectrum Virtualize Family storage back-end performance and applies to mirror replication types such as metro, global and GMCV volume replication types. closes bug: #1906528 Change-Id: I43ff6533436bb8467862d9b6e9dd3fc82290d20d --- .../volume/drivers/ibm/test_storwize_svc.py | 4 -- .../drivers/ibm/storwize_svc/replication.py | 47 +++++---------- .../ibm/storwize_svc/storwize_svc_common.py | 60 +++---------------- ...-switch-relationship-b5b7320811688cda.yaml | 7 +++ 4 files changed, 29 insertions(+), 89 deletions(-) create mode 100644 releasenotes/notes/bug-1906528-ibm-svf-fix-host-failback-switch-relationship-b5b7320811688cda.yaml diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index 179fe3b3d9e..010d6b7cee9 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -11505,10 +11505,6 @@ class StorwizeSVCReplicationTestCase(test.TestCase): self.driver.failover_replication, self.ctxt, group, vols, self.fake_target['backend_id']) - self.assertRaises(exception.UnableToFailOver, - self.driver.failover_replication, self.ctxt, group, - vols, storwize_const.FAILBACK_VALUE) - with mock.patch.object(storwize_svc_common.StorwizeSSH, 'stoprcconsistgrp') as stoprccg: stoprccg.side_effect = exception.VolumeBackendAPIException( diff --git a/cinder/volume/drivers/ibm/storwize_svc/replication.py b/cinder/volume/drivers/ibm/storwize_svc/replication.py index 927a49ea195..75b3270728e 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/replication.py +++ b/cinder/volume/drivers/ibm/storwize_svc/replication.py @@ -56,8 +56,21 @@ class StorwizeSVCReplication(object): LOG.exception(msg) raise exception.VolumeDriverException(message=msg) + @volume_utils.trace def replication_failback(self, volume): - pass + tgt_volume = storwize_const.REPLICA_AUX_VOL_PREFIX + volume['name'] + rel_info = self.target_helpers.get_relationship_info(tgt_volume) + if rel_info: + try: + self.target_helpers.stop_relationship(tgt_volume, access=True) + self.target_helpers.start_relationship(tgt_volume, 'master') + return + except Exception as e: + msg = (_('Unable to fail-back the volume: %(vol)s to the ' + 'master back-end, error: %(error)s') % + {"vol": volume['name'], "error": six.text_type(e)}) + LOG.exception(msg) + raise exception.VolumeDriverException(message=msg) def volume_replication_setup(self, context, vref): pass @@ -108,21 +121,6 @@ class StorwizeSVCReplicationGlobalMirror(StorwizeSVCReplication): raise exception.VolumeDriverException(message=msg) LOG.debug('leave: volume_replication_setup:volume %s', vref['name']) - def replication_failback(self, volume): - tgt_volume = storwize_const.REPLICA_AUX_VOL_PREFIX + volume['name'] - rel_info = self.target_helpers.get_relationship_info(tgt_volume) - if rel_info: - try: - self.target_helpers.switch_relationship(rel_info['name'], - aux=False) - return - except Exception as e: - msg = (_('Unable to fail-back the volume:%(vol)s to the ' - 'master back-end, error:%(error)s') % - {"vol": volume['name'], "error": e}) - LOG.exception(msg) - raise exception.VolumeDriverException(message=msg) - class StorwizeSVCReplicationMetroMirror( StorwizeSVCReplicationGlobalMirror): @@ -232,23 +230,6 @@ class StorwizeSVCReplicationGMCV(StorwizeSVCReplicationGlobalMirror): raise exception.VolumeDriverException(message=msg) LOG.debug('leave: volume_replication_setup:volume %s', vref['name']) - def replication_failback(self, volume): - LOG.debug('enter: replication_failback: volume=%(volume)s', - {'volume': volume['name']}) - tgt_volume = storwize_const.REPLICA_AUX_VOL_PREFIX + volume['name'] - rel_info = self.target_helpers.get_relationship_info(tgt_volume) - if rel_info: - try: - self.target_helpers.stop_relationship(tgt_volume, access=True) - self.target_helpers.start_relationship(tgt_volume, 'master') - return - except Exception as e: - msg = (_('Unable to fail-back the volume:%(vol)s to the ' - 'master back-end, error:%(error)s') % - {"vol": volume['name'], "error": six.text_type(e)}) - LOG.exception(msg) - raise exception.VolumeDriverException(message=msg) - class StorwizeSVCReplicationManager(object): diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index 20b9c76ee4a..0e3667e65ed 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -4295,6 +4295,7 @@ class StorwizeSVCCommonDriver(san.SanDriver, volumes_model_update.append(volume_model_update) return model_update, volumes_model_update + @volume_utils.trace def _rep_grp_failback(self, ctxt, group, sync_grp=True): """Fail back all the volume in the replication group.""" model_update = { @@ -4302,59 +4303,14 @@ class StorwizeSVCCommonDriver(san.SanDriver, rccg_name = self._get_rccg_name(group) try: - self._master_backend_helpers.get_system_info() - except Exception as ex: - msg = (_("Unable to failback group %(rccg)s due to primary is not " - "reachable. error=%(error)s"), - {'rccg': rccg_name, 'error': ex}) - LOG.error(msg) - raise exception.UnableToFailOver(reason=msg) - - rccg = self._helpers.get_rccg(rccg_name) - if not rccg: - msg = (_("Unable to failback group %(rccg)s due to replication " - "group does not exist on backend."), - {'rccg': rccg_name}) - LOG.error(msg) - raise exception.UnableToFailOver(reason=msg) - - if rccg['relationship_count'] == '0': - msg = (_("Unable to failback empty group %(rccg)s"), - {'rccg': rccg['name']}) - LOG.error(msg) - raise exception.UnableToFailOver(reason=msg) - - if rccg['primary'] == 'master': - LOG.info("Do not need to fail back group %(rccg)s again due to " - "primary is already master.", {'rccg': rccg['name']}) + self._aux_backend_helpers.stop_rccg(rccg_name, access=True) + self._aux_backend_helpers.start_rccg(rccg_name, primary='master') return model_update - - if sync_grp: - self._sync_with_aux_grp(ctxt, rccg['name']) - self._wait_replica_grp_ready(ctxt, rccg['name']) - - if rccg['cycling_mode'] == 'multi': - # This is a gmcv replication group - try: - self._aux_backend_helpers.stop_rccg(rccg['name'], access=True) - self._aux_backend_helpers.start_rccg(rccg['name'], - primary='master') - return model_update - except exception.VolumeBackendAPIException as e: - msg = (_('Unable to fail over the group %(rccg)s to the aux ' - 'back-end, error: %(error)s') % - {"rccg": rccg['name'], "error": e}) - LOG.exception(msg) - raise exception.UnableToFailOver(reason=msg) - else: - try: - self._helpers.switch_rccg(rccg['name'], aux=False) - except exception.VolumeBackendAPIException as e: - msg = (_('Unable to fail back the group %(rccg)s, error: ' - '%(error)s') % {"rccg": rccg['name'], "error": e}) - LOG.exception(msg) - raise exception.UnableToFailOver(reason=msg) - return model_update + except exception.VolumeBackendAPIException as e: + msg = (_('Unable to fail back the group %(rccg)s, error: ' + '%(error)s') % {"rccg": rccg_name, "error": e}) + LOG.exception(msg) + raise exception.UnableToFailOver(reason=msg) @volume_utils.trace def _rep_grp_failover(self, ctxt, group): diff --git a/releasenotes/notes/bug-1906528-ibm-svf-fix-host-failback-switch-relationship-b5b7320811688cda.yaml b/releasenotes/notes/bug-1906528-ibm-svf-fix-host-failback-switch-relationship-b5b7320811688cda.yaml new file mode 100644 index 00000000000..82e04c6b157 --- /dev/null +++ b/releasenotes/notes/bug-1906528-ibm-svf-fix-host-failback-switch-relationship-b5b7320811688cda.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + `Bug #1906528 `_: + IBM Spectrum Virtualize Family driver: Fixed issue regarding + host-failback and group-failback which impacts storage back-end + performance.