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
This commit is contained in:
Ryan Liang 2017-06-30 15:10:35 +08:00
parent 5a23d639b0
commit ee32ed6a57
4 changed files with 10 additions and 13 deletions

View File

@ -210,18 +210,14 @@ class UnityClient(object):
LOG.info('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)

View File

@ -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)

View File

@ -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)

View File

@ -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.