[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
This commit is contained in:
venkatakrishnathumu 2020-12-02 15:18:27 +00:00
parent 23d76e01f2
commit 2f5885e4bf
4 changed files with 29 additions and 89 deletions

View File

@ -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(

View File

@ -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):

View File

@ -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})
'%(error)s') % {"rccg": rccg_name, "error": e})
LOG.exception(msg)
raise exception.UnableToFailOver(reason=msg)
return model_update
@volume_utils.trace
def _rep_grp_failover(self, ctxt, group):

View File

@ -0,0 +1,7 @@
---
fixes:
- |
`Bug #1906528 <https://bugs.launchpad.net/cinder/+bug/1906528>`_:
IBM Spectrum Virtualize Family driver: Fixed issue regarding
host-failback and group-failback which impacts storage back-end
performance.