share-size not set to 1 with 'manage_error' state
Currently, when we set share-state to 'manage-error', share-size is set to 1 at all places except this one. Which results in error logged during delete-share, w.r.t quota. This fix sets share-size to 1 when share state is set to 'manage_error'. Change-Id: I96343ffd4f273b01c0376713717cdc89ea9a873a Closes-Bug: #1587636
This commit is contained in:
parent
20adb836c3
commit
e8d2b34dd7
@ -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)
|
||||
|
@ -258,13 +258,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."""
|
||||
|
@ -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.
|
||||
|
@ -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'.
|
Loading…
Reference in New Issue
Block a user