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
This commit is contained in:
Rodrigo Barbieri 2017-02-01 15:41:03 -02:00
parent 595a2bd73c
commit 26c803ea95
3 changed files with 26 additions and 0 deletions

View File

@ -1106,6 +1106,15 @@ class API(base.Base):
LOG.error(msg) LOG.error(msg)
raise exception.Conflict(err=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 # We only handle "available" share for now
if share_instance['status'] != constants.STATUS_AVAILABLE: if share_instance['status'] != constants.STATUS_AVAILABLE:
msg = _('Share instance %(instance_id)s status must be available, ' msg = _('Share instance %(instance_id)s status must be available, '

View File

@ -2644,6 +2644,18 @@ class ShareAPITestCase(test.TestCase):
self.assertTrue(mock_log.error.called) self.assertTrue(mock_log.error.called)
self.assertFalse(mock_snapshot_get_call.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): def test_migration_start_invalid_host(self):
host = 'fake@backend#pool' host = 'fake@backend#pool'
share = db_utils.create_share( share = db_utils.create_share(

View File

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