summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Liang <ryan.liang@dell.com>2018-09-28 09:58:43 +0800
committerRyan Liang <ryan.liang@emc.com>2020-08-06 02:25:09 +0000
commit8641eed2ea5b0b62ef0209e86ed7446a18232784 (patch)
treec4ab327a22757af85f1d00002ea10edaf0df3998
parent2ecda828e9539a5c3fef554c357c18e27af951fa (diff)
downloadcinder-8641eed2ea5b0b62ef0209e86ed7446a18232784.tar.gz
VNX: delete the LUN from VNX backend
Async migration is used in the process of creating a volume from a snapshot and an internal temp snapshot is created. Because the temp snapshot isn't deleted, the LUN hosting the temp snapshot cannot be deleted from the VNX storage. For example, a new volume, V2, is created from snapshot S1 of volume V1. An internal temp snapshot S2 is created from copying S1. V1 now has two snapshots, S1 and S2. Although we delete V1, V2 and S1 from Cinder, S2 which is Cinder user-invisible isn't deleted and which causes V1 left on VNX too. The fix makes sure the snapshot S2 is deleted. Then the delay deletion on V1 can be executed successfully. Change-Id: Ib86729488ebfb0aea5d5d4f815a64e00258040e7 Closes-bug: #1794646 Conflicts: cinder/volume/drivers/dell_emc/vnx/driver.py (cherry picked from commit b3a89dc187ae4d71fb1fc27645cb4383209b0ef8) (cherry picked from commit a74945b0687c4aa69960777fb301984cd4d2fedd) (cherry picked from commit 6e2e278f3c97ee14d7b18272cee5bfea1c231768)
-rw-r--r--cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_cinder.yaml6
-rw-r--r--cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml14
-rw-r--r--cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py25
-rw-r--r--cinder/volume/drivers/dell_emc/vnx/adapter.py4
-rw-r--r--cinder/volume/drivers/dell_emc/vnx/driver.py4
-rw-r--r--releasenotes/notes/vnx-fail-delete-lun-due-to-tmp-snapshot-edd3cdd85e28be60.yaml9
6 files changed, 59 insertions, 3 deletions
diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_cinder.yaml b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_cinder.yaml
index d633db12e..445be3213 100644
--- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_cinder.yaml
+++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_cinder.yaml
@@ -127,6 +127,12 @@ test_delete_async_volume:
test_delete_async_volume_migrating:
volume: *volume_base
+test_delete_async_volume_not_from_snapshot:
+ volume: *volume_base
+
+test_delete_async_volume_from_snapshot:
+ volume: *volume_base
+
test_retype_need_migration_when_host_changed:
volume: *volume_base
host:
diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml
index e643d894c..3970ae216 100644
--- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml
+++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml
@@ -1467,6 +1467,20 @@ test_delete_async_volume_migrating:
get_lun: *lun_used_by_feature
get_snap: *snap_test_delete_async_volume
+test_delete_async_volume_not_from_snapshot:
+ vnx:
+ _methods:
+ get_lun: *lun_test_delete_lun
+
+test_delete_async_volume_from_snapshot:
+ snap: &snap_test_delete_async_volume_from_snapshot
+ _methods:
+ delete:
+ vnx:
+ _methods:
+ get_lun: *lun_test_delete_lun
+ get_snap: *snap_test_delete_async_volume_from_snapshot
+
test_enable_compression:
lun:
_properties:
diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py
index 22483ca68..fbe522c13 100644
--- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py
+++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py
@@ -450,6 +450,31 @@ class TestCommonAdapter(test.TestCase):
lun = vnx_common.client.vnx.get_lun()
lun.delete.assert_called_with(force_detach=True, detach_from_sg=True)
+ @res_mock.mock_driver_input
+ @res_mock.patch_common_adapter
+ def test_delete_async_volume_not_from_snapshot(self, vnx_common, mocked,
+ mocked_input):
+ volume = mocked_input['volume']
+ volume.metadata = {'async_migrate': 'True'}
+ vnx_common.force_delete_lun_in_sg = True
+ vnx_common.delete_volume(volume)
+ lun = vnx_common.client.vnx.get_lun()
+ lun.delete.assert_called_with(force_detach=True, detach_from_sg=True)
+
+ @res_mock.mock_driver_input
+ @res_mock.patch_common_adapter
+ def test_delete_async_volume_from_snapshot(self, vnx_common, mocked,
+ mocked_input):
+ volume = mocked_input['volume']
+ volume.metadata = {'async_migrate': 'True'}
+ volume.snapshot_id = 'snap'
+ vnx_common.force_delete_lun_in_sg = True
+ vnx_common.delete_volume(volume)
+ lun = vnx_common.client.vnx.get_lun()
+ lun.delete.assert_called_with(force_detach=True, detach_from_sg=True)
+ snap = vnx_common.client.vnx.get_snap()
+ snap.delete.assert_called_with()
+
@utils.patch_extra_specs_validate(side_effect=exception.InvalidVolumeType(
reason='fake_reason'))
@res_mock.patch_common_adapter
diff --git a/cinder/volume/drivers/dell_emc/vnx/adapter.py b/cinder/volume/drivers/dell_emc/vnx/adapter.py
index f52401df3..904661c33 100644
--- a/cinder/volume/drivers/dell_emc/vnx/adapter.py
+++ b/cinder/volume/drivers/dell_emc/vnx/adapter.py
@@ -798,8 +798,8 @@ class CommonAdapter(replication.ReplicationAdapter):
# for later deletion
self.client.delay_delete_lun(volume.name)
# Case 2. Migration already finished, try to delete the temp snap
- # only when it's a cloned volume.
- if async_migrate and volume.source_volid:
+ # when it's a cloned volume or created from snapshot.
+ if async_migrate and (volume.source_volid or volume.snapshot_id):
self.client.delete_snapshot(utils.construct_snap_name(volume))
def extend_volume(self, volume, new_size):
diff --git a/cinder/volume/drivers/dell_emc/vnx/driver.py b/cinder/volume/drivers/dell_emc/vnx/driver.py
index 71ccdf0db..ecc492ecb 100644
--- a/cinder/volume/drivers/dell_emc/vnx/driver.py
+++ b/cinder/volume/drivers/dell_emc/vnx/driver.py
@@ -81,9 +81,11 @@ class VNXDriver(driver.ManageableVD,
11.0.2 - Fix bug https://bugs.launchpad.net/cinder/+bug/1817385 to
make sure sg can be created again after it was destroyed
under `destroy_empty_stroage_group` setting to `True`
+ 11.0.3 - Fix bug 1794646: failed to delete LUNs from backend due to
+ the temporary snapshots on them wasn't deleted.
"""
- VERSION = '11.00.02'
+ VERSION = '11.00.03'
VENDOR = 'Dell EMC'
# ThirdPartySystems wiki page
CI_WIKI_NAME = "EMC_VNX_CI"
diff --git a/releasenotes/notes/vnx-fail-delete-lun-due-to-tmp-snapshot-edd3cdd85e28be60.yaml b/releasenotes/notes/vnx-fail-delete-lun-due-to-tmp-snapshot-edd3cdd85e28be60.yaml
new file mode 100644
index 000000000..61d882bc4
--- /dev/null
+++ b/releasenotes/notes/vnx-fail-delete-lun-due-to-tmp-snapshot-edd3cdd85e28be60.yaml
@@ -0,0 +1,9 @@
+---
+fixes:
+ - |
+ Dell EMC VNX Cinder Driver: Fixes `bug 1794646
+ <https://bugs.launchpad.net/cinder/+bug/1794646>`__ to delete the LUN from
+ the VNX storage. Because a temporary snapshot is created from the LUN
+ during creating a volume from a snapshot and isn't deleted, the LUN cannot
+ be deleted before its snapshot is deleted. The fix makes sure the temp
+ snapshot is deleted.