From 281788715b618384168e69b1c1e5b17b10e37bb3 Mon Sep 17 00:00:00 2001 From: Kiran Pawar Date: Wed, 17 Aug 2022 10:21:21 +0000 Subject: [PATCH] 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 --- manila/scheduler/drivers/filter.py | 6 +++++- manila/scheduler/host_manager.py | 8 ++++++++ ...scheduler-default-extend-filters-1c4f2a1863d0d95b.yaml | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-1973621-add-scheduler-default-extend-filters-1c4f2a1863d0d95b.yaml diff --git a/manila/scheduler/drivers/filter.py b/manila/scheduler/drivers/filter.py index 9b44dc8d29..f27e82ab81 100644 --- a/manila/scheduler/drivers/filter.py +++ b/manila/scheduler/drivers/filter.py @@ -531,8 +531,12 @@ class FilterScheduler(base.Scheduler): context, filter_properties, request_spec) 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, filter_properties) + hosts, filter_properties, + filter_class_names=filter_class_names) hosts = self.host_manager.get_weighed_hosts(hosts, filter_properties) for tgt_host in hosts: diff --git a/manila/scheduler/host_manager.py b/manila/scheduler/host_manager.py index bc3e984c91..bca77c362e 100644 --- a/manila/scheduler/host_manager.py +++ b/manila/scheduler/host_manager.py @@ -69,6 +69,14 @@ host_manager_opts = [ ], help='Which filter class names to use for filtering hosts ' '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 diff --git a/releasenotes/notes/bug-1973621-add-scheduler-default-extend-filters-1c4f2a1863d0d95b.yaml b/releasenotes/notes/bug-1973621-add-scheduler-default-extend-filters-1c4f2a1863d0d95b.yaml new file mode 100644 index 0000000000..d844027029 --- /dev/null +++ b/releasenotes/notes/bug-1973621-add-scheduler-default-extend-filters-1c4f2a1863d0d95b.yaml @@ -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`.