diff options
author | Zuul <zuul@review.opendev.org> | 2022-05-25 22:59:54 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-05-25 22:59:54 +0000 |
commit | e302532b04c57c01f1855fd8ff8690ed31028960 (patch) | |
tree | 3370fd14e0b6b3506be0080f8435f22b2d2605cb | |
parent | bfcef4982a0d9b41ad11ab5df904001554af903f (diff) | |
parent | ad2db70a6492391a1fb2538db916a7a7b7f5ca9a (diff) | |
download | cinder-e302532b04c57c01f1855fd8ff8690ed31028960.tar.gz |
Merge "PureStorage FlashArray: Add active/active replication" into stable/xena
-rw-r--r-- | cinder/tests/unit/volume/drivers/test_pure.py | 6 | ||||
-rw-r--r-- | cinder/volume/drivers/pure.py | 31 | ||||
-rw-r--r-- | releasenotes/notes/pure_aa_replication-e3f5f6666f0b0c43.yaml | 6 |
3 files changed, 35 insertions, 8 deletions
diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index f516c3de9..c27f49130 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -2940,7 +2940,7 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase): array2_v1_3.get_volume.return_value = REPLICATED_VOLUME_SNAPS context = mock.MagicMock() - new_active_id, volume_updates, __ = self.driver.failover_host( + new_active_id, volume_updates, __ = self.driver.failover( context, REPLICATED_VOLUME_OBJS, None, @@ -3018,7 +3018,7 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase): {"name": sync_replicated_vol_name} ] - new_active_id, volume_updates, __ = self.driver.failover_host( + new_active_id, volume_updates, __ = self.driver.failover( context, [ not_replicated_vol, @@ -3082,7 +3082,7 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase): mock_get_array, array2_v1_3.get_volume, self.async_array2.copy_volume], - self.driver.failover_host, + self.driver.failover, mock.Mock(), REPLICATED_VOLUME_OBJS, None ) diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index e1527f2df..2b7db30cd 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -1966,6 +1966,31 @@ class PureBaseVolumeDriver(san.SanDriver): @pure_driver_debug_trace def failover_host(self, context, volumes, secondary_id=None, groups=None): + """Failover to replication target. + + This function combines calls to failover() and failover_completed() to + perform failover when Active/Active is not enabled. + """ + active_backend_id, volume_update_list, group_update_list = ( + self.failover(context, volumes, secondary_id, groups)) + self.failover_completed(context, secondary_id) + return active_backend_id, volume_update_list, group_update_list + + @pure_driver_debug_trace + def failover_completed(self, context, secondary_id=None): + """Failover to replication target.""" + LOG.info('Driver failover completion started.') + if secondary_id == 'default': + self._swap_replication_state(self._get_current_array(), + self._failed_over_primary_array, + failback=True) + else: + self._swap_replication_state(self._get_current_array(), + self._find_sync_failover_target()) + LOG.info('Driver failover completion completed.') + + @pure_driver_debug_trace + def failover(self, context, volumes, secondary_id=None, groups=None): """Failover backend to a secondary array This action will not affect the original volumes in any @@ -2001,9 +2026,6 @@ class PureBaseVolumeDriver(san.SanDriver): 'status': 'error', } }) - self._swap_replication_state(current_array, - self._failed_over_primary_array, - failback=True) return secondary_id, model_updates, [] else: msg = _('Unable to failback to "default", this can only be ' @@ -2074,7 +2096,6 @@ class PureBaseVolumeDriver(san.SanDriver): model_updates = self._sync_failover_host(volumes, secondary_array) current_array = self._get_current_array() - self._swap_replication_state(current_array, secondary_array) return secondary_array.backend_id, model_updates, [] @@ -2151,7 +2172,7 @@ class PureBaseVolumeDriver(san.SanDriver): if secondary_array in self._uniform_active_cluster_target_arrays: self._uniform_active_cluster_target_arrays.remove( secondary_array) - current_array.unform = True + current_array.uniform = True self._uniform_active_cluster_target_arrays.append(current_array) self._set_current_array(secondary_array) diff --git a/releasenotes/notes/pure_aa_replication-e3f5f6666f0b0c43.yaml b/releasenotes/notes/pure_aa_replication-e3f5f6666f0b0c43.yaml new file mode 100644 index 000000000..2c7a2ca72 --- /dev/null +++ b/releasenotes/notes/pure_aa_replication-e3f5f6666f0b0c43.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Pure Storage FlashArray driver: Enabled support for Active/Active + replication for the FlashArray driver. This allows users to configure + FlashArray backends in clustered environments. |