PowerMax Driver - Fix for group snapshot deletion

If a group snapshot did not exist on the array, an exception
was thrown which prevented its deletion from OpenStack.  This
fix checks for is existance and if it doesn't, removes it
gracefully.

Change-Id: Ibafdd77f7925ec400f8f8c4052826f55b1721eaa
This commit is contained in:
Helen Walsh 2021-07-22 17:07:12 +01:00
parent 776d56ff69
commit fdcad20100
2 changed files with 12 additions and 11 deletions

View File

@ -2774,11 +2774,13 @@ class PowerMaxCommonTest(test.TestCase):
snapshots))
self.assertEqual(ref_model_update, model_update)
def test_delete_group_snapshot_failed(self):
group_snapshot = self.data.test_group_snapshot_failed
@mock.patch.object(common.PowerMaxCommon, '_find_volume_group',
return_value=None)
def test_delete_group_snapshot_not_on_array(self, mock_gvg):
group_snapshot = self.data.test_group_snapshot_1
snapshots = []
ref_model_update = (
{'status': fields.GroupSnapshotStatus.ERROR_DELETING})
{'status': fields.GroupSnapshotStatus.DELETED})
with mock.patch.object(volume_utils, 'is_group_a_cg_snapshot_type',
return_value=True):
model_update, snapshots_model_update = (

View File

@ -6003,14 +6003,13 @@ class PowerMaxCommon(object):
if volume_group and volume_group.get('name'):
vol_grp_name = volume_group['name']
if vol_grp_name is None:
exception_message = (
_("Cannot find generic volume group %(grp_id)s.") %
{'group_id': source_group.id})
raise exception.VolumeBackendAPIException(
message=exception_message)
self.provision.delete_group_replica(
array, snap_name, vol_grp_name)
LOG.warning("Cannot find generic volume group %(grp_ss_id)s. "
"on array %(array)s",
{'grp_ss_id': group_snapshot.id,
'array': array})
else:
self.provision.delete_group_replica(
array, snap_name, vol_grp_name)
model_update = {'status': fields.GroupSnapshotStatus.DELETED}
for snapshot in snapshots: