From 1f105766734165d71e491d7e28a0e8f70292ffdb Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Thu, 1 Jul 2021 17:39:03 +0800 Subject: [PATCH] Deprecate Aggregate[CPU|Ram|Disk]Filters Their functionality has been replace by placement API so these filters should no longer used. Change-Id: I0e7c42fcc907571cba84b1147e63767ccad9088e --- ...eprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml | 7 +++++++ zun/conf/scheduler.py | 3 --- zun/scheduler/filters/cpu_filter.py | 11 ++++++++++- zun/scheduler/filters/disk_filter.py | 11 ++++++++++- zun/scheduler/filters/ram_filter.py | 11 ++++++++++- 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml diff --git a/releasenotes/notes/deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml b/releasenotes/notes/deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml new file mode 100644 index 000000000..a4de92615 --- /dev/null +++ b/releasenotes/notes/deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The ``CPUFilter``, ``RamFilter`` and + ``DiskFilter`` are now deprecated. + They will be removed in a future release and should no longer be used. + Their functionality has been replaced with a placement native approach. diff --git a/zun/conf/scheduler.py b/zun/conf/scheduler.py index 75498d9f0..9a85d4536 100644 --- a/zun/conf/scheduler.py +++ b/zun/conf/scheduler.py @@ -64,10 +64,7 @@ Related options: cfg.ListOpt("enabled_filters", default=[ "AvailabilityZoneFilter", - "CPUFilter", - "RamFilter", "ComputeFilter", - "DiskFilter", "RuntimeFilter", ], help=""" diff --git a/zun/scheduler/filters/cpu_filter.py b/zun/scheduler/filters/cpu_filter.py index b71cd379b..d2e1923f3 100644 --- a/zun/scheduler/filters/cpu_filter.py +++ b/zun/scheduler/filters/cpu_filter.py @@ -21,10 +21,19 @@ LOG = logging.getLogger(__name__) class CPUFilter(filters.BaseHostFilter): - """Filter the containers by cpu request""" + """DEPRECATED: Filter the containers by cpu request""" run_filter_once_per_request = True + def __init__(self): + super(CPUFilter, self).__init__() + LOG.warning('The CPUFilter is deprecated since the 7.0.0 ' + 'Wallaby release. VCPU filtering is performed natively ' + 'using the Placement service when using the ' + 'filter_scheduler driver. Operators should define cpu ' + 'allocation ratios either per host in the zun.conf ' + 'or via the placement API.') + def host_passes(self, host_state, container, extra_spec): if not container.cpu: return True diff --git a/zun/scheduler/filters/disk_filter.py b/zun/scheduler/filters/disk_filter.py index d9c494514..66936b464 100644 --- a/zun/scheduler/filters/disk_filter.py +++ b/zun/scheduler/filters/disk_filter.py @@ -21,10 +21,19 @@ LOG = logging.getLogger(__name__) class DiskFilter(filters.BaseHostFilter): - """Filter the containers by disk request""" + """DEPRECATED: Filter the containers by disk request""" run_filter_once_per_request = True + def __init__(self): + super(DiskFilter, self).__init__() + LOG.warning('The DiskFilter is deprecated since the 7.0.0 ' + 'Wallaby release. DISK_GB filtering is performed natively ' + 'using the Placement service when using the ' + 'filter_scheduler driver. Operators should define disk ' + 'allocation ratios either per host in the zun.conf ' + 'or via the placement API.') + def host_passes(self, host_state, container, extra_spec): if not hasattr(container, 'disk') or not container.disk: return True diff --git a/zun/scheduler/filters/ram_filter.py b/zun/scheduler/filters/ram_filter.py index 7f0da34b7..4bea5ec99 100644 --- a/zun/scheduler/filters/ram_filter.py +++ b/zun/scheduler/filters/ram_filter.py @@ -21,10 +21,19 @@ LOG = logging.getLogger(__name__) class RamFilter(filters.BaseHostFilter): - """Filter the containers by memory request""" + """DEPRECATED: Filter the containers by memory request""" run_filter_once_per_request = True + def __init__(self): + super(RamFilter, self).__init__() + LOG.warning('The RamFilter is deprecated since the 7.0.0 ' + 'Wallaby release. MEMORY_MB filtering is performed ' + 'natively using the Placement service when using the ' + 'filter_scheduler driver. Operators should define ram ' + 'allocation ratios either per host in the zun.conf ' + 'or via the placement API.') + def host_passes(self, host_state, container, extra_spec): if not container.memory: return True