Browse Source

Merge "PowerMax Driver - Failover group vol update fix"

tags/17.0.0.0rc1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
6f98e8f09f
2 changed files with 23 additions and 5 deletions
  1. +13
    -0
      cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py
  2. +10
    -5
      cinder/volume/drivers/dell_emc/powermax/common.py

+ 13
- 0
cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py View File

@@ -618,6 +618,19 @@ class PowerMaxReplicationTest(test.TestCase):

self.assertEqual(ref_vol_update, vols_model_update[0])

@mock.patch.object(common.PowerMaxCommon, '_initial_setup',
return_value=tpd.PowerMaxData.extra_specs)
def test_populate_volume_and_group_update_lists_group_update_vol_list(
self, mck_setup):
volume = deepcopy(self.data.test_volume)
volume.group_id = self.data.test_group.id
volumes = [volume]
groups = [self.data.test_group]
volume_updates, group_updates = (
self.common._populate_volume_and_group_update_lists(
volumes, groups, None))
self.assertEqual([volume], volumes)

@mock.patch.object(
utils.PowerMaxUtils, 'validate_non_replication_group_config')
@mock.patch.object(volume_utils, 'is_group_a_cg_snapshot_type',


+ 10
- 5
cinder/volume/drivers/dell_emc/powermax/common.py View File

@@ -5218,16 +5218,21 @@ class PowerMaxCommon(object):
"""
volume_update_list = []
group_update_list = []
# Since we are updating volumes if a volume is in a group, copy to
# a new variable otherwise we will be updating the replicated_vols
# variable assigned in manager.py's failover method.
vols = deepcopy(volumes)

if groups:
for group in groups:
vol_list = []
for index, vol in enumerate(volumes):
group_vol_list = []
for index, vol in enumerate(vols):
if vol.group_id == group.id:
vol_list.append(volumes.pop(index))
group_vol_list.append(vols[index])
vols = [vol for vol in vols if vol not in group_vol_list]
grp_update, vol_updates = (
self.failover_replication(
None, group, vol_list, group_fo, host=True))
None, group, group_vol_list, group_fo, host=True))

group_update_list.append({'group_id': group.id,
'updates': grp_update})
@@ -5235,7 +5240,7 @@ class PowerMaxCommon(object):

non_rep_vol_list, sync_vol_dict, async_vol_dict, metro_vol_list = (
[], {}, {}, [])
for volume in volumes:
for volume in vols:
array = ast.literal_eval(volume.provider_location)['array']
extra_specs = self._initial_setup(volume)
extra_specs[utils.ARRAY] = array


Loading…
Cancel
Save