Fix fallback share group snapshot implementation

When a share driver does not provide the capability
to create share group snapshots, the share manager
iterates over the shares in the group and invokes the
driver method to snapshot the shares. However, the
create and delete routines in this fallback path
did not include some attributes necessary for the
operation in many drivers.

Change-Id: Id5a9467247df1d8f0ec6dee3fae842ba673c34ed
Closes-Bug: #1888905
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
(cherry picked from commit a398743264)
(cherry picked from commit e49075dfee)
This commit is contained in:
Goutham Pacha Ravi 2020-07-24 15:56:57 -07:00
parent 4e292ea884
commit 4ac14e017b
3 changed files with 34 additions and 0 deletions

View File

@ -1477,6 +1477,8 @@ class ShareDriver(object):
'share': <models.Share>,
'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'share_proto': 'NFS',
'share_name': 'share_some_fake_uuid',
'name': 'share-snapshot-some_fake_uuid',
'project_id': '13c0be6290934bd98596cfa004650049',
'share_group_snapshot_id': 'some_fake_uuid',
'deleted_at': None,
@ -1519,6 +1521,8 @@ class ShareDriver(object):
'share_instance_id': member['share']['id'],
'id': member['id'],
'share': member['share'],
'share_name': member['share_name'],
'name': member['name'],
'size': member['share']['size'],
'share_size': member['share']['size'],
'share_proto': member['share']['share_proto'],
@ -1581,6 +1585,8 @@ class ShareDriver(object):
'share': <models.Share>,
'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'share_proto': 'NFS',
'share_name':'share_some_fake_uuid',
'name': 'share-snapshot-some_fake_uuid',
'project_id': '13c0be6290934bd98596cfa004650049',
'share_group_snapshot_id': 'some_fake_uuid',
'deleted_at': None,
@ -1608,6 +1614,8 @@ class ShareDriver(object):
'id': member['id'],
'share': member['share'],
'size': member['share']['size'],
'share_name': member['share_name'],
'name': member['name'],
'share_size': member['share']['size'],
'share_proto': member['share']['share_proto'],
'provider_location': member['provider_location'],

View File

@ -809,6 +809,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_1',
'provider_location': 'should_not_be_used_1',
'share_name': 'share_fake_share_instance_id_1',
'name': 'share-snapshot-6813e06b-a8f5-4784-b17d-f3e91afa370e',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': 3,
@ -821,6 +823,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_2',
'provider_location': 'should_not_be_used_2',
'share_name': 'share_fake_share_instance_id_2',
'name': 'share-snapshot-1e010dfe-545b-432d-ab95-4ef03cd82f89',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': '2',
@ -859,6 +863,8 @@ class ShareDriverTestCase(test.TestCase):
'share_instance_id': member['share']['id'],
'id': member['id'],
'share': member['share'],
'share_name': member['share_name'],
'name': member['name'],
'size': member['share']['size'],
'share_size': member['share']['size'],
'share_proto': member['share']['share_proto'],
@ -881,6 +887,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_1',
'provider_location': 'should_not_be_used_1',
'share_name': 'share_fake_share_instance_id_1',
'name': 'share-snapshot-6813e06b-a8f5-4784-b17d-f3e91afa370e',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': 3,
@ -893,6 +901,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_2',
'provider_location': 'should_not_be_used_2',
'share_name': 'share_fake_share_instance_id_2',
'name': 'share-snapshot-1e010dfe-545b-432d-ab95-4ef03cd82f89',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': '2',
@ -932,6 +942,8 @@ class ShareDriverTestCase(test.TestCase):
'share_instance_id': fake_snap_member_1['share']['id'],
'id': fake_snap_member_1['id'],
'share': fake_snap_member_1['share'],
'share_name': fake_snap_member_1['share_name'],
'name': fake_snap_member_1['name'],
'size': fake_snap_member_1['share']['size'],
'share_size': fake_snap_member_1['share']['size'],
'share_proto': fake_snap_member_1['share']['share_proto'],
@ -945,6 +957,8 @@ class ShareDriverTestCase(test.TestCase):
'share_instance_id': member['share']['id'],
'id': member['id'],
'share': member['share'],
'share_name': member['share_name'],
'name': member['name'],
'size': member['share']['size'],
'share_size': member['share']['size'],
'share_proto': member['share']['share_proto'],
@ -1020,6 +1034,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_1',
'provider_location': 'fake_provider_location_2',
'share_name': 'share_fake_share_instance_id_1',
'name': 'share-snapshot-6813e06b-a8f5-4784-b17d-f3e91afa370e',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': 3,
@ -1032,6 +1048,8 @@ class ShareDriverTestCase(test.TestCase):
'share_group_snapshot_id': 'fake_share_group_snapshot_id',
'share_instance_id': 'fake_share_instance_id_2',
'provider_location': 'fake_provider_location_2',
'share_name': 'share_fake_provider_location_2',
'name': 'share-snapshot-1e010dfe-545b-432d-ab95-4ef03cd82f89',
'share': {
'id': '420f978b-dbf6-4b3c-92fe-f5b17a0bb5e2',
'size': '2',
@ -1070,6 +1088,8 @@ class ShareDriverTestCase(test.TestCase):
'share': member['share'],
'size': member['share']['size'],
'share_size': member['share']['size'],
'share_name': member['share_name'],
'name': member['name'],
'share_proto': member['share']['share_proto'],
'provider_location': member['provider_location']},
share_server=None)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
An error with share group snapshot creation and deletion due to missing
attributes has been fixed. See `Launchpad bug 1888905
<https://launchpad.net/bugs/1888905>`_ for more information.