Merge "share-size not set to 1 with 'manage_error' state"

This commit is contained in:
Jenkins 2016-09-08 21:46:47 +00:00 committed by Gerrit Code Review
commit a7dc61e425
4 changed files with 19 additions and 2 deletions

View File

@ -126,9 +126,12 @@ class SchedulerManager(manager.Manager):
"""Ensure that the host exists and can accept the share."""
def _manage_share_set_error(self, context, ex, request_spec):
# NOTE(nidhimittalhada): set size as 1 because design expects size
# to be set, it also will allow us to handle delete/unmanage
# operations properly with this errored share according to quotas.
self._set_share_state_and_notify(
'manage_share',
{'status': constants.STATUS_MANAGE_ERROR},
{'status': constants.STATUS_MANAGE_ERROR, 'size': 1},
context, ex, request_spec)
share_ref = db.share_get(context, share_id)

View File

@ -290,13 +290,20 @@ class SchedulerManagerTestCase(test.TestCase):
share = db_utils.create_share()
db_update = self.mock_object(db, 'share_update', mock.Mock())
self.mock_object(
base.Scheduler, 'host_passes_filters',
mock.Mock(side_effect=exception.NoValidHost('fake')))
share_id = share['id']
self.assertRaises(
exception.NoValidHost, self.manager.manage_share,
self.context, share['id'], 'driver_options', {}, None)
self.context, share['id'], 'driver_options',
{'share_id': share_id}, None)
db_update.assert_called_once_with(
self.context, share_id,
{'status': constants.STATUS_MANAGE_ERROR, 'size': 1})
def test_create_share_replica_exception_path(self):
"""Test 'raisable' exceptions for create_share_replica."""

View File

@ -212,6 +212,8 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
self.shares_v2_client.wait_for_share_status(
share['id'], 'manage_error')
share = self.shares_v2_client.get_share(share['id'])
self.assertEqual(1, int(share['size']))
# Delete resource from backend. We need to manage the share properly
# so it can be removed.

View File

@ -0,0 +1,5 @@
---
fixes:
- Any errors that may occur during 'managing' a share into manila will
result in the share's size being set to 1, aside from transitioning
the status to 'manage_error'.