HPE3PAR: Fix filestore quota decrement
HPE3PAR driver keeps a filestore fsquota to limit the space available to all the nested shares. This fsquota should not be decremented when read-only shares are removed. In this case 3PAR read-only shares are only used when the files exist in a snapshot or in a read-write share. So the read-only share itself does not hold any space. If a read-write share is removed, then the decrement happens. Change-Id: I1f006ce7e6cb2473f11b1505c1b7d4946aa5e1fc Closes-Bug: #1599618
This commit is contained in:
parent
6f506a8705
commit
443b61f668
|
@ -648,8 +648,10 @@ class HPE3ParMediator(object):
|
|||
vfs,
|
||||
allow_cross_protocol=True)
|
||||
|
||||
removed_writable = False
|
||||
if fstore:
|
||||
self._delete_share(share_name, protocol, fpg, vfs, fstore)
|
||||
removed_writable = True
|
||||
|
||||
share_name_ro = self.ensure_prefix(share_id, readonly=True)
|
||||
if not fstore:
|
||||
|
@ -671,7 +673,7 @@ class HPE3ParMediator(object):
|
|||
LOG.exception(msg)
|
||||
raise exception.ShareBackendException(msg=msg)
|
||||
|
||||
else:
|
||||
elif removed_writable:
|
||||
try:
|
||||
# Attempt to remove file tree on delete when using nested
|
||||
# shares. If the file tree cannot be removed for whatever
|
||||
|
|
|
@ -657,18 +657,8 @@ class HPE3ParMediatorTestCase(test.TestCase):
|
|||
self.mock_object(self.mediator,
|
||||
'_find_fstore',
|
||||
mock.Mock(side_effect=fstores))
|
||||
self.mock_object(self.mediator,
|
||||
'_create_mount_directory',
|
||||
mock.Mock(return_value={}))
|
||||
self.mock_object(self.mediator,
|
||||
'_mount_super_share',
|
||||
mock.Mock(return_value={}))
|
||||
self.mock_object(self.mediator,
|
||||
'_delete_share_directory',
|
||||
mock.Mock(return_value={}))
|
||||
self.mock_object(self.mediator,
|
||||
'_unmount_super_share',
|
||||
mock.Mock(return_value={}))
|
||||
self.mock_object(self.mediator, '_delete_file_tree')
|
||||
self.mock_object(self.mediator, '_update_capacity_quotas')
|
||||
|
||||
self.mediator.delete_share(constants.EXPECTED_PROJECT_ID,
|
||||
constants.EXPECTED_SHARE_ID,
|
||||
|
@ -685,17 +675,8 @@ class HPE3ParMediatorTestCase(test.TestCase):
|
|||
fstore=constants.EXPECTED_FSTORE
|
||||
)
|
||||
|
||||
expected_mount_path = constants.EXPECTED_MOUNT_PATH + (
|
||||
constants.EXPECTED_SHARE_ID)
|
||||
self.mediator._create_mount_directory.assert_called_with(
|
||||
expected_mount_path)
|
||||
self.mediator._mount_super_share.assert_called_with(
|
||||
constants.NFS_LOWER, expected_mount_path, constants.EXPECTED_FPG,
|
||||
constants.EXPECTED_VFS, constants.EXPECTED_PROJECT_ID)
|
||||
self.mediator._delete_share_directory.assert_called_with(
|
||||
expected_mount_path)
|
||||
self.mediator._unmount_super_share.assert_called_with(
|
||||
expected_mount_path)
|
||||
self.assertFalse(self.mediator._delete_file_tree.called)
|
||||
self.assertFalse(self.mediator._update_capacity_quotas.called)
|
||||
|
||||
def test_mediator_delete_share_exception(self):
|
||||
self.init_mediator()
|
||||
|
|
Loading…
Reference in New Issue