Merge "update capacity filter during extend share" into stable/xena

This commit is contained in:
Zuul 2023-04-06 21:53:21 +00:00 committed by Gerrit Code Review
commit f16183b192
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

@ -327,12 +327,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.