From 8dbc944af52872ab083d13579e1b4c4e7776cf60 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 30 Jun 2017 15:10:35 +0800 Subject: [PATCH] Unity: unexpected data in share from snapshot The share created from snapshot had inconsistent data with the snapshot, but consistent with the original share. Because the snapshot was created on wrong `storage resource`. Change-Id: Ia135c93bd9eedaba549426ea9233a90767de5d46 Closes-bug: 1701458 (cherry picked from commit ee32ed6a576d09ae576c481b0ddf1ccb89daab75) --- manila/share/drivers/dell_emc/plugins/unity/client.py | 8 ++------ manila/share/drivers/dell_emc/plugins/unity/connection.py | 7 ++----- .../share/drivers/dell_emc/plugins/unity/test_client.py | 3 +-- ...expected-data-of-share-from-snap-134189fc0f3eeedf.yaml | 5 +++++ 4 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/unexpected-data-of-share-from-snap-134189fc0f3eeedf.yaml diff --git a/manila/share/drivers/dell_emc/plugins/unity/client.py b/manila/share/drivers/dell_emc/plugins/unity/client.py index 06d6694602..17e85100a7 100644 --- a/manila/share/drivers/dell_emc/plugins/unity/client.py +++ b/manila/share/drivers/dell_emc/plugins/unity/client.py @@ -212,18 +212,14 @@ class UnityClient(object): LOG.info(_LI('Snapshot %(snap)s on Filesystem %(fs)s already ' 'exists.'), {'snap': name, 'fs': filesystem.name}) - def create_snap_of_snap(self, src_snap, dst_snap_name, snap_type): - access_type = enums.FilesystemSnapAccessTypeEnum.PROTOCOL - if snap_type == 'checkpoint': - access_type = enums.FilesystemSnapAccessTypeEnum.CHECKPOINT - + def create_snap_of_snap(self, src_snap, dst_snap_name): if isinstance(src_snap, six.string_types): snap = self.get_snapshot(name=src_snap) else: snap = src_snap try: - return snap.create_snap(dst_snap_name, fs_access_type=access_type) + return snap.create_snap(dst_snap_name) except storops_ex.UnitySnapNameInUseError: return self.get_snapshot(dst_snap_name) diff --git a/manila/share/drivers/dell_emc/plugins/unity/connection.py b/manila/share/drivers/dell_emc/plugins/unity/connection.py index 4d150738e5..3b62983cce 100644 --- a/manila/share/drivers/dell_emc/plugins/unity/connection.py +++ b/manila/share/drivers/dell_emc/plugins/unity/connection.py @@ -213,8 +213,7 @@ class UnityStorageConnection(driver.StorageConnection): raise exception.EMCUnityError(err=message) backend_snap = self.client.create_snap_of_snap(snapshot['id'], - share_name, - snap_type='snapshot') + share_name) locations = None if share_proto == 'CIFS': @@ -274,9 +273,7 @@ class UnityStorageConnection(driver.StorageConnection): snapshot_name = snapshot['id'] if self._is_share_from_snapshot(backend_share): - self.client.create_snap_of_snap(backend_share.snap, - snapshot_name, - snap_type='checkpoint') + self.client.create_snap_of_snap(backend_share.snap, snapshot_name) else: self.client.create_snapshot(backend_share.filesystem, snapshot_name) diff --git a/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py b/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py index d498422198..2aaa3324ae 100644 --- a/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py +++ b/manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py @@ -148,8 +148,7 @@ class TestClient(test.TestCase): snapshot = mocked_input['src_snapshot'] dest_snap = mocked_input['dest_snapshot'] - new_snap = client.create_snap_of_snap( - snapshot, dest_snap.name, 'checkpoint') + new_snap = client.create_snap_of_snap(snapshot, dest_snap.name) self.assertEqual(dest_snap.name, new_snap.name) diff --git a/releasenotes/notes/unexpected-data-of-share-from-snap-134189fc0f3eeedf.yaml b/releasenotes/notes/unexpected-data-of-share-from-snap-134189fc0f3eeedf.yaml new file mode 100644 index 0000000000..745fc20665 --- /dev/null +++ b/releasenotes/notes/unexpected-data-of-share-from-snap-134189fc0f3eeedf.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Fixed bug in Dell EMC Unity driver that caused shares created from + snapshots to contain data from the original shares, instead of data from + their snapshots.