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 ' LOG.info('Snapshot %(snap)s on Filesystem %(fs)s already '
'exists.', {'snap': name, 'fs': filesystem.name}) 'exists.', {'snap': name, 'fs': filesystem.name})
def create_snap_of_snap(self, src_snap, dst_snap_name, snap_type): def create_snap_of_snap(self, src_snap, dst_snap_name):
access_type = enums.FilesystemSnapAccessTypeEnum.PROTOCOL
if snap_type == 'checkpoint':
access_type = enums.FilesystemSnapAccessTypeEnum.CHECKPOINT
if isinstance(src_snap, six.string_types): if isinstance(src_snap, six.string_types):
snap = self.get_snapshot(name=src_snap) snap = self.get_snapshot(name=src_snap)
else: else:
snap = src_snap snap = src_snap
try: try:
return snap.create_snap(dst_snap_name, fs_access_type=access_type) return snap.create_snap(dst_snap_name)
except storops_ex.UnitySnapNameInUseError: except storops_ex.UnitySnapNameInUseError:
return self.get_snapshot(dst_snap_name) return self.get_snapshot(dst_snap_name)

View File

@ -213,8 +213,7 @@ class UnityStorageConnection(driver.StorageConnection):
raise exception.EMCUnityError(err=message) raise exception.EMCUnityError(err=message)
backend_snap = self.client.create_snap_of_snap(snapshot['id'], backend_snap = self.client.create_snap_of_snap(snapshot['id'],
share_name, share_name)
snap_type='snapshot')
locations = None locations = None
if share_proto == 'CIFS': if share_proto == 'CIFS':
@ -274,9 +273,7 @@ class UnityStorageConnection(driver.StorageConnection):
snapshot_name = snapshot['id'] snapshot_name = snapshot['id']
if self._is_share_from_snapshot(backend_share): if self._is_share_from_snapshot(backend_share):
self.client.create_snap_of_snap(backend_share.snap, self.client.create_snap_of_snap(backend_share.snap, snapshot_name)
snapshot_name,
snap_type='checkpoint')
else: else:
self.client.create_snapshot(backend_share.filesystem, self.client.create_snapshot(backend_share.filesystem,
snapshot_name) snapshot_name)

View File

@ -148,8 +148,7 @@ class TestClient(test.TestCase):
snapshot = mocked_input['src_snapshot'] snapshot = mocked_input['src_snapshot']
dest_snap = mocked_input['dest_snapshot'] dest_snap = mocked_input['dest_snapshot']
new_snap = client.create_snap_of_snap( new_snap = client.create_snap_of_snap(snapshot, dest_snap.name)
snapshot, dest_snap.name, 'checkpoint')
self.assertEqual(dest_snap.name, new_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.