PowerMax Driver - Offline r1 promotion fixes

Reset replication enabled and configuration metadata
during promotion retype with offline r1 array.
Get management storage group name from source
extra_specs during promotion.

Closes-Bug: #1908920
Change-Id: Ia9521fd225eb6f8239aa955dc923fff76f0b8052
(cherry picked from commit cb02f9dfea)
This commit is contained in:
odonos12 2020-09-16 19:42:55 +01:00 committed by Helen Walsh
parent 990cba70ee
commit 7df39ebe84
4 changed files with 51 additions and 2 deletions

View File

@ -3970,6 +3970,26 @@ class PowerMaxCommonTest(test.TestCase):
self.data.test_volume, None)
self.assertEqual(self.data.rep_extra_specs_metro, extra_specs)
@mock.patch.object(utils.PowerMaxUtils, 'get_rdf_management_group_name')
def test_retype_volume_promotion_get_extra_specs_mgmt_group(self, mck_get):
array = self.data.array
srp = self.data.srp
device_id = self.data.device_id
volume = self.data.test_volume
volume_name = self.data.volume_id
extra_specs = deepcopy(self.data.rep_extra_specs)
target_slo = self.data.slo_silver
target_workload = self.data.workload
target_extra_specs = deepcopy(self.data.extra_specs)
target_extra_specs[utils.DISABLECOMPRESSION] = False
extra_specs[utils.REP_CONFIG] = self.data.rep_config_async
self.common.promotion = True
self.common._retype_volume(
array, srp, device_id, volume, volume_name, extra_specs,
target_slo, target_workload, target_extra_specs)
self.common.promotion = False
mck_get.assert_called_once_with(extra_specs[utils.REP_CONFIG])
@mock.patch.object(rest.PowerMaxRest, 'is_volume_in_storagegroup',
return_value=True)
@mock.patch.object(masking.PowerMaxMasking,

View File

@ -1213,6 +1213,10 @@ class PowerMaxReplicationTest(test.TestCase):
self.assertTrue(success)
self.common.promotion = False
@mock.patch.object(
common.PowerMaxCommon, 'update_metadata',
return_value={'metadata': {
'Configuration': 'RDF2+TDEV', 'ReplicationEnabled': 'True'}})
@mock.patch.object(
common.PowerMaxCommon, '_rdf_vols_partitioned',
return_value=True)
@ -1227,7 +1231,8 @@ class PowerMaxReplicationTest(test.TestCase):
common.PowerMaxCommon, '_retype_volume',
return_value=(True, tpd.PowerMaxData.defaultstoragegroup_name))
def test_migrate_volume_success_rep_partitioned(
self, mck_retype, mck_get, mck_break, mck_valid, mck_partitioned):
self, mck_retype, mck_get, mck_break, mck_valid, mck_partitioned,
mck_update):
array_id = self.data.array
volume = self.data.test_rep_volume
device_id = self.data.device_id
@ -1253,6 +1258,10 @@ class PowerMaxReplicationTest(test.TestCase):
target_slo, target_workload, target_extra_specs)
self.assertTrue(success)
self.common.promotion = False
config_metadata = model_update['metadata']['Configuration']
rep_metadata = model_update['metadata']['ReplicationEnabled']
self.assertEqual('TDEV', config_metadata)
self.assertEqual('False', rep_metadata)
@mock.patch.object(masking.PowerMaxMasking, 'add_volume_to_storage_group')
@mock.patch.object(provision.PowerMaxProvision, 'get_or_create_group')

View File

@ -3940,6 +3940,7 @@ class PowerMaxCommon(object):
resume_target_sg, resume_original_sg = False, False
resume_original_sg_dict = dict()
orig_mgmt_sg_name = ''
is_partitioned = False
target_extra_specs = dict(new_type['extra_specs'])
target_extra_specs.update({
@ -4089,6 +4090,12 @@ class PowerMaxCommon(object):
host_details[array_index] = array
updated_host = '+'.join(host_details)
model_update['host'] = updated_host
if is_partitioned:
# Must set these here as offline R1 promotion does
# not perform rdf cleanup.
model_update[
'metadata']['ReplicationEnabled'] = 'False'
model_update['metadata']['Configuration'] = 'TDEV'
target_backend_id = None
if is_rep_enabled:
@ -4221,7 +4228,12 @@ class PowerMaxCommon(object):
parent_sg = None
if self.utils.is_replication_enabled(target_extra_specs):
is_re, rep_mode = True, target_extra_specs['rep_mode']
if self.utils.is_replication_enabled(extra_specs):
mgmt_sg_name = self.utils.get_rdf_management_group_name(
target_extra_specs[utils.REP_CONFIG])
if self.promotion and self.utils.is_replication_enabled(extra_specs):
# Need to check this when performing promotion while R1 is offline
# as RDF cleanup is not performed. Target is not RDF enabled
# in that scenario.
mgmt_sg_name = self.utils.get_rdf_management_group_name(
extra_specs[utils.REP_CONFIG])

View File

@ -0,0 +1,8 @@
---
fixes:
- |
PowerMax Driver - `bug #1908920
<https://bugs.launchpad.net/cinder/+bug/1908920>`_: This offline r1
promotion fix resets replication enabled and configuration metadata
during promotion retype with offline r1 array. It also gets management
storage group name from source extra_specs during promotion.