update capacity filter during extend share

use size increase to calculate provisioned_ratio during
extend share.

Closes-Bug: #1968891

Change-Id: I2d4903d6a2fda588b126a062c755db2fa2b09cdb
(cherry picked from commit e5d644fec3)
(cherry picked from commit 19be7bb13a)
(cherry picked from commit 9e05299994)
This commit is contained in:
haixin 2022-04-18 12:42:18 +08:00 committed by Goutham Pacha Ravi
parent f320288f47
commit 24a1b097ec
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): def host_passes(self, host_state, filter_properties):
"""Return True if host has sufficient capacity.""" """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: if host_state.free_capacity_gb is None:
# Fail Safe # Fail Safe

View File

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