Browse Source

Blocked migration of shares within share groups

In Ocata, coordination between share migration and share groups
features was not implemented. So, restrict its usage for now.

APIImpact

Change-Id: Id15453590685aa9c7788e79a33ca98b4dcc8a3ea
Closes-bug: #1660336
Closes-bug: #1660319
changes/34/427834/2
Rodrigo Barbieri 5 years ago
parent
commit
26c803ea95
  1. 9
      manila/share/api.py
  2. 12
      manila/tests/share/test_api.py
  3. 5
      releasenotes/notes/bug-1660319-1660336-migration-share-groups-e66a1478634947ad.yaml

9
manila/share/api.py

@ -1106,6 +1106,15 @@ class API(base.Base):
LOG.error(msg)
raise exception.Conflict(err=msg)
# TODO(ganso): We do not support migrating shares in or out of groups
# for now.
if share.get('share_group_id'):
msg = _('Share %s is a member of a group. This operation is not '
'currently supported for shares that are members of '
'groups.') % share['id']
LOG.error(msg)
raise exception.InvalidShare(reason=msg)
# We only handle "available" share for now
if share_instance['status'] != constants.STATUS_AVAILABLE:
msg = _('Share instance %(instance_id)s status must be available, '

12
manila/tests/share/test_api.py

@ -2644,6 +2644,18 @@ class ShareAPITestCase(test.TestCase):
self.assertTrue(mock_log.error.called)
self.assertFalse(mock_snapshot_get_call.called)
def test_migration_start_is_member_of_group(self):
group = db_utils.create_share_group()
share = db_utils.create_share(
host='fake@backend#pool', status=constants.STATUS_AVAILABLE,
share_group_id=group['id'])
mock_log = self.mock_object(share_api, 'LOG')
self.assertRaises(exception.InvalidShare, self.api.migration_start,
self.context, share, 'fake_host', False, True, True,
True, True)
self.assertTrue(mock_log.error.called)
def test_migration_start_invalid_host(self):
host = 'fake@backend#pool'
share = db_utils.create_share(

5
releasenotes/notes/bug-1660319-1660336-migration-share-groups-e66a1478634947ad.yaml

@ -0,0 +1,5 @@
---
fixes:
- Shares can no longer be migrated while being
members of share groups.
Loading…
Cancel
Save