update capacity filter during extend share

use size increase to calculate provisioned_ratio during
extend share.

Closes-Bug: #1968891

Change-Id: I2d4903d6a2fda588b126a062c755db2fa2b09cdb
This commit is contained in:
haixin 2022-04-18 12:42:18 +08:00 committed by Goutham Pacha Ravi
parent 29db644db5
commit e5d644fec3
3 changed files with 15 additions and 3 deletions

View File

@ -32,7 +32,9 @@ class CapacityFilter(base_host.BaseHostFilter):
def host_passes(self, host_state, filter_properties):
"""Return True if host has sufficient capacity."""
share_size = filter_properties.get('size', 0)
size_increase = filter_properties.get('size_increase')
share_size = size_increase if size_increase else filter_properties.get(
'size', 0)
if host_state.free_capacity_gb is None:
# Fail Safe

View File

@ -333,12 +333,16 @@ class SchedulerManager(manager.Manager):
share = db.share_get(context, share_id)
try:
size_increase = int(new_size) - share['size']
if filter_properties:
filter_properties['size_increase'] = size_increase
else:
filter_properties = {'size_increase': size_increase}
target_host = self.driver.host_passes_filters(
context,
share['host'],
request_spec, filter_properties)
target_host.consume_from_share(
{'size': int(new_size) - share['size']})
target_host.consume_from_share({'size': size_increase})
share_rpcapi.ShareAPI().extend_share(context, share, new_size,
reservations)
except exception.NoValidHost as ex:

View File

@ -0,0 +1,6 @@
---
fixes:
- |
`Launchpad bug 1968891 <https://bugs.launchpad.net/manila/+bug/1968891>`_
has been fixed. scheduler will use size increase rather than share size
to calculate provisioned_ratio when extending share.