From 49ba8943e5ae051c05eb7df081a0648a2ed7d136 Mon Sep 17 00:00:00 2001 From: michael-mcaleer Date: Wed, 13 Feb 2019 14:36:55 +0000 Subject: [PATCH] PowerMax Driver - Unmanage Snapshot Improvements This change removes an expensive and unnecessary call in the unmanage snapshot operation. An additional log warning has also been added to notify users of the inability to delete volumes where a linked snapshot has been unmanaged but still existsX on the back end storage array. Change-Id: I77720dc8e3b3c79e60d0ea16939a80480067215e --- .../drivers/dell_emc/powermax/test_powermax_common.py | 10 ++++++++-- cinder/volume/drivers/dell_emc/powermax/common.py | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py index b7e1cc6875b..214813666cc 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py @@ -2301,12 +2301,18 @@ class PowerMaxCommonTest(test.TestCase): self.common.manage_existing_snapshot, snapshot, existing_ref) - @mock.patch.object(common.PowerMaxCommon, '_sync_check') @mock.patch.object(rest.PowerMaxRest, 'modify_volume_snap') - def test_unmanage_snapshot_success(self, mock_mod, mock_sync): + def test_unmanage_snapshot_success(self, mock_mod, ): self.common.unmanage_snapshot(self.data.test_snapshot_manage) mock_mod.assert_called_once() + @mock.patch.object(common.PowerMaxCommon, '_sync_check') + @mock.patch.object(rest.PowerMaxRest, 'modify_volume_snap') + def test_unmanage_snapshot_no_sync_check(self, mock_mod, mock_sync): + self.common.unmanage_snapshot(self.data.test_snapshot_manage) + mock_mod.assert_called_once() + mock_sync.assert_not_called() + @mock.patch.object(utils.PowerMaxUtils, 'is_volume_failed_over', return_value=True) def test_unmanage_snapshot_fail_failover(self, mock_failed): diff --git a/cinder/volume/drivers/dell_emc/powermax/common.py b/cinder/volume/drivers/dell_emc/powermax/common.py index 38d6a8110ed..1acb3d469cb 100644 --- a/cinder/volume/drivers/dell_emc/powermax/common.py +++ b/cinder/volume/drivers/dell_emc/powermax/common.py @@ -2602,12 +2602,15 @@ class PowerMaxCommon(object): raise exception.VolumeBackendAPIException( message=exception_message) - self._sync_check(array, device_id, extra_specs) - LOG.info("Snapshot %(snap_name)s is no longer managed in " "OpenStack but still remains on PowerMax/VMAX source " "%(array_id)s", {'snap_name': snap_name, 'array_id': array}) + LOG.warning("In order to remove the snapshot source volume from " + "OpenStack you will need to either delete the linked " + "SnapVX snapshot on the array or un-manage the volume " + "from Cinder.") + def get_manageable_volumes(self, marker, limit, offset, sort_keys, sort_dirs): """Lists all manageable volumes.