Add scheduler_default_extend_filters option.

Instead of using all default filters of share create operation, use only
necessary list of filters for share extend operation. A new config
option `scheduler_default_extend_filters` is added to provide such list
of filters e.g. CapacityFilter.

Closes-Bug: #1973621
Change-Id: I162325f3096227b74a58b9a55de4660668454d4b
This commit is contained in:
Kiran Pawar 2022-08-17 10:21:21 +00:00
parent 1115e412c0
commit 281788715b
3 changed files with 19 additions and 1 deletions

View File

@ -531,8 +531,12 @@ class FilterScheduler(base.Scheduler):
context, filter_properties, request_spec) context, filter_properties, request_spec)
hosts = self.host_manager.get_all_host_states_share(elevated) hosts = self.host_manager.get_all_host_states_share(elevated)
filter_class_names = None
if request_spec.get('is_share_extend', None):
filter_class_names = CONF.scheduler_default_extend_filters
hosts, last_filter = self.host_manager.get_filtered_hosts( hosts, last_filter = self.host_manager.get_filtered_hosts(
hosts, filter_properties) hosts, filter_properties,
filter_class_names=filter_class_names)
hosts = self.host_manager.get_weighed_hosts(hosts, filter_properties) hosts = self.host_manager.get_weighed_hosts(hosts, filter_properties)
for tgt_host in hosts: for tgt_host in hosts:

View File

@ -69,6 +69,14 @@ host_manager_opts = [
], ],
help='Which filter class names to use for filtering hosts ' help='Which filter class names to use for filtering hosts '
'creating share group when not specified in the request.'), 'creating share group when not specified in the request.'),
cfg.ListOpt(
'scheduler_default_extend_filters',
default=[
'CapacityFilter',
'DriverFilter',
],
help='Which filter class names to use for filtering hosts '
'extending share when not specified in the request.'),
] ]
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
When using scheduler filters during share extend, only few filters are
necessary. To provide those configurable list of filters for share extend,
added new option `scheduler_default_extend_filters`.