Merge "PowerMax Driver - Failover group vol update fix"
This commit is contained in:
commit
6f98e8f09f
@ -618,6 +618,19 @@ class PowerMaxReplicationTest(test.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(ref_vol_update, vols_model_update[0])
|
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(
|
@mock.patch.object(
|
||||||
utils.PowerMaxUtils, 'validate_non_replication_group_config')
|
utils.PowerMaxUtils, 'validate_non_replication_group_config')
|
||||||
@mock.patch.object(volume_utils, 'is_group_a_cg_snapshot_type',
|
@mock.patch.object(volume_utils, 'is_group_a_cg_snapshot_type',
|
||||||
|
@ -5218,16 +5218,21 @@ class PowerMaxCommon(object):
|
|||||||
"""
|
"""
|
||||||
volume_update_list = []
|
volume_update_list = []
|
||||||
group_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:
|
if groups:
|
||||||
for group in groups:
|
for group in groups:
|
||||||
vol_list = []
|
group_vol_list = []
|
||||||
for index, vol in enumerate(volumes):
|
for index, vol in enumerate(vols):
|
||||||
if vol.group_id == group.id:
|
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 = (
|
grp_update, vol_updates = (
|
||||||
self.failover_replication(
|
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,
|
group_update_list.append({'group_id': group.id,
|
||||||
'updates': grp_update})
|
'updates': grp_update})
|
||||||
@ -5235,7 +5240,7 @@ class PowerMaxCommon(object):
|
|||||||
|
|
||||||
non_rep_vol_list, sync_vol_dict, async_vol_dict, metro_vol_list = (
|
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']
|
array = ast.literal_eval(volume.provider_location)['array']
|
||||||
extra_specs = self._initial_setup(volume)
|
extra_specs = self._initial_setup(volume)
|
||||||
extra_specs[utils.ARRAY] = array
|
extra_specs[utils.ARRAY] = array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user