Merge "Remove ExactCoreFilter ExactDiskFilter ExactRamFilter"
This commit is contained in:
commit
4238cfbde0
@ -416,23 +416,6 @@ greater than ``1.0``:
|
|||||||
space, as the value approaching ``0`` may result in the incorrect
|
space, as the value approaching ``0`` may result in the incorrect
|
||||||
functioning of instances using it at the moment.
|
functioning of instances using it at the moment.
|
||||||
|
|
||||||
ExactCoreFilter
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Only schedules instances on hosts if host has the exact number of CPU cores.
|
|
||||||
|
|
||||||
ExactDiskFilter
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Only schedules instances on hosts if host has the exact amount of disk
|
|
||||||
available.
|
|
||||||
|
|
||||||
ExactRamFilter
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Only schedules instances on hosts if host has the exact number of RAM
|
|
||||||
available.
|
|
||||||
|
|
||||||
.. _ImagePropertiesFilter:
|
.. _ImagePropertiesFilter:
|
||||||
|
|
||||||
ImagePropertiesFilter
|
ImagePropertiesFilter
|
||||||
|
@ -341,9 +341,6 @@ Related options:
|
|||||||
"ComputeFilter",
|
"ComputeFilter",
|
||||||
"ComputeCapabilitiesFilter",
|
"ComputeCapabilitiesFilter",
|
||||||
"ImagePropertiesFilter",
|
"ImagePropertiesFilter",
|
||||||
"ExactRamFilter",
|
|
||||||
"ExactDiskFilter",
|
|
||||||
"ExactCoreFilter",
|
|
||||||
],
|
],
|
||||||
deprecated_name="baremetal_scheduler_default_filters",
|
deprecated_name="baremetal_scheduler_default_filters",
|
||||||
deprecated_group="DEFAULT",
|
deprecated_group="DEFAULT",
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
# Copyright (c) 2014 OpenStack Foundation
|
|
||||||
#
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from nova.i18n import _LW
|
|
||||||
from nova.scheduler import filters
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ExactCoreFilter(filters.BaseHostFilter):
|
|
||||||
"""Exact Core Filter."""
|
|
||||||
|
|
||||||
RUN_ON_REBUILD = False
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(ExactCoreFilter, self).__init__(*args, **kwargs)
|
|
||||||
LOG.warning('ExactCoreFilter is deprecated in Pike and will be '
|
|
||||||
'removed in a subsequent release.')
|
|
||||||
|
|
||||||
def host_passes(self, host_state, spec_obj):
|
|
||||||
"""Return True if host has the exact number of CPU cores."""
|
|
||||||
if not host_state.vcpus_total:
|
|
||||||
# Fail safe
|
|
||||||
LOG.warning(_LW("VCPUs not set; assuming CPU collection broken"))
|
|
||||||
return False
|
|
||||||
|
|
||||||
required_vcpus = spec_obj.vcpus
|
|
||||||
usable_vcpus = host_state.vcpus_total - host_state.vcpus_used
|
|
||||||
|
|
||||||
if required_vcpus != usable_vcpus:
|
|
||||||
LOG.debug("%(host_state)s does not have exactly "
|
|
||||||
"%(requested_vcpus)s cores of usable vcpu, it has "
|
|
||||||
"%(usable_vcpus)s.",
|
|
||||||
{'host_state': host_state,
|
|
||||||
'requested_vcpus': required_vcpus,
|
|
||||||
'usable_vcpus': usable_vcpus})
|
|
||||||
return False
|
|
||||||
|
|
||||||
# NOTE(mgoddard): Setting the limit ensures that it is enforced in
|
|
||||||
# compute. This ensures that if multiple instances are scheduled to a
|
|
||||||
# single host, then all after the first will fail in the claim.
|
|
||||||
host_state.limits['vcpu'] = host_state.vcpus_total
|
|
||||||
return True
|
|
@ -1,52 +0,0 @@
|
|||||||
# Copyright (c) 2014 OpenStack Foundation
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from nova.scheduler import filters
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ExactDiskFilter(filters.BaseHostFilter):
|
|
||||||
"""Exact Disk Filter."""
|
|
||||||
|
|
||||||
RUN_ON_REBUILD = False
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(ExactDiskFilter, self).__init__(*args, **kwargs)
|
|
||||||
LOG.warning('ExactDiskFilter is deprecated in Pike and will be '
|
|
||||||
'removed in a subsequent release.')
|
|
||||||
|
|
||||||
def host_passes(self, host_state, spec_obj):
|
|
||||||
"""Return True if host has the exact amount of disk available."""
|
|
||||||
requested_disk = (1024 * (spec_obj.root_gb +
|
|
||||||
spec_obj.ephemeral_gb) +
|
|
||||||
spec_obj.swap)
|
|
||||||
|
|
||||||
if requested_disk != host_state.free_disk_mb:
|
|
||||||
LOG.debug("%(host_state)s does not have exactly "
|
|
||||||
"%(requested_disk)s MB usable disk, it "
|
|
||||||
"has %(usable_disk_mb)s.",
|
|
||||||
{'host_state': host_state,
|
|
||||||
'requested_disk': requested_disk,
|
|
||||||
'usable_disk_mb': host_state.free_disk_mb})
|
|
||||||
return False
|
|
||||||
|
|
||||||
# NOTE(mgoddard): Setting the limit ensures that it is enforced in
|
|
||||||
# compute. This ensures that if multiple instances are scheduled to a
|
|
||||||
# single host, then all after the first will fail in the claim.
|
|
||||||
host_state.limits['disk_gb'] = host_state.total_usable_disk_gb
|
|
||||||
return True
|
|
@ -1,49 +0,0 @@
|
|||||||
# Copyright (c) 2014 OpenStack Foundation
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from nova.scheduler import filters
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ExactRamFilter(filters.BaseHostFilter):
|
|
||||||
"""Exact RAM Filter."""
|
|
||||||
|
|
||||||
RUN_ON_REBUILD = False
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(ExactRamFilter, self).__init__(*args, **kwargs)
|
|
||||||
LOG.warning('ExactRamFilter is deprecated in Pike and will be '
|
|
||||||
'removed in a subsequent release.')
|
|
||||||
|
|
||||||
def host_passes(self, host_state, spec_obj):
|
|
||||||
"""Return True if host has the exact amount of RAM available."""
|
|
||||||
requested_ram = spec_obj.memory_mb
|
|
||||||
if requested_ram != host_state.free_ram_mb:
|
|
||||||
LOG.debug("%(host_state)s does not have exactly "
|
|
||||||
"%(requested_ram)s MB usable RAM, it has "
|
|
||||||
"%(usable_ram)s MB.",
|
|
||||||
{'host_state': host_state,
|
|
||||||
'requested_ram': requested_ram,
|
|
||||||
'usable_ram': host_state.free_ram_mb})
|
|
||||||
return False
|
|
||||||
|
|
||||||
# NOTE(mgoddard): Setting the limit ensures that it is enforced in
|
|
||||||
# compute. This ensures that if multiple instances are scheduled to a
|
|
||||||
# single host, then all after the first will fail in the claim.
|
|
||||||
host_state.limits['memory_mb'] = host_state.total_usable_ram_mb
|
|
||||||
return True
|
|
@ -1,48 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from nova import objects
|
|
||||||
from nova.scheduler.filters import exact_core_filter
|
|
||||||
from nova import test
|
|
||||||
from nova.tests.unit.scheduler import fakes
|
|
||||||
|
|
||||||
|
|
||||||
class TestExactCoreFilter(test.NoDBTestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestExactCoreFilter, self).setUp()
|
|
||||||
self.filt_cls = exact_core_filter.ExactCoreFilter()
|
|
||||||
|
|
||||||
def test_exact_core_filter_passes(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(vcpus=1))
|
|
||||||
vcpus = 3
|
|
||||||
host = self._get_host({'vcpus_total': vcpus, 'vcpus_used': vcpus - 1})
|
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertEqual(host.limits.get('vcpu'), vcpus)
|
|
||||||
|
|
||||||
def test_exact_core_filter_fails(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(vcpus=2))
|
|
||||||
host = self._get_host({'vcpus_total': 3, 'vcpus_used': 2})
|
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertNotIn('vcpu', host.limits)
|
|
||||||
|
|
||||||
def test_exact_core_filter_fails_host_vcpus_not_set(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(vcpus=1))
|
|
||||||
host = self._get_host({})
|
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertNotIn('vcpu', host.limits)
|
|
||||||
|
|
||||||
def _get_host(self, host_attributes):
|
|
||||||
return fakes.FakeHostState('host1', 'node1', host_attributes)
|
|
@ -1,42 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from nova import objects
|
|
||||||
from nova.scheduler.filters import exact_disk_filter
|
|
||||||
from nova import test
|
|
||||||
from nova.tests.unit.scheduler import fakes
|
|
||||||
|
|
||||||
|
|
||||||
class TestExactDiskFilter(test.NoDBTestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestExactDiskFilter, self).setUp()
|
|
||||||
self.filt_cls = exact_disk_filter.ExactDiskFilter()
|
|
||||||
|
|
||||||
def test_exact_disk_filter_passes(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(root_gb=1, ephemeral_gb=1, swap=1024))
|
|
||||||
disk_gb = 3
|
|
||||||
host = self._get_host({'free_disk_mb': disk_gb * 1024,
|
|
||||||
'total_usable_disk_gb': disk_gb})
|
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertEqual(host.limits.get('disk_gb'), disk_gb)
|
|
||||||
|
|
||||||
def test_exact_disk_filter_fails(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(root_gb=1, ephemeral_gb=1, swap=1024))
|
|
||||||
host = self._get_host({'free_disk_mb': 2 * 1024})
|
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertNotIn('disk_gb', host.limits)
|
|
||||||
|
|
||||||
def _get_host(self, host_attributes):
|
|
||||||
return fakes.FakeHostState('host1', 'node1', host_attributes)
|
|
@ -1,42 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from nova import objects
|
|
||||||
from nova.scheduler.filters import exact_ram_filter
|
|
||||||
from nova import test
|
|
||||||
from nova.tests.unit.scheduler import fakes
|
|
||||||
|
|
||||||
|
|
||||||
class TestRamFilter(test.NoDBTestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestRamFilter, self).setUp()
|
|
||||||
self.filt_cls = exact_ram_filter.ExactRamFilter()
|
|
||||||
|
|
||||||
def test_exact_ram_filter_passes(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(memory_mb=1024))
|
|
||||||
ram_mb = 1024
|
|
||||||
host = self._get_host({'free_ram_mb': ram_mb,
|
|
||||||
'total_usable_ram_mb': ram_mb})
|
|
||||||
self.assertTrue(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertEqual(host.limits.get('memory_mb'), ram_mb)
|
|
||||||
|
|
||||||
def test_exact_ram_filter_fails(self):
|
|
||||||
spec_obj = objects.RequestSpec(
|
|
||||||
flavor=objects.Flavor(memory_mb=512))
|
|
||||||
host = self._get_host({'free_ram_mb': 1024})
|
|
||||||
self.assertFalse(self.filt_cls.host_passes(host, spec_obj))
|
|
||||||
self.assertNotIn('memory_mb', host.limits)
|
|
||||||
|
|
||||||
def _get_host(self, host_attributes):
|
|
||||||
return fakes.FakeHostState('host1', 'node1', host_attributes)
|
|
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
ExactCoreFilter, ExactDiskFilter and ExactRamFilter were deprecated for
|
||||||
|
removal in the 16.0.0 Pike release and have now been removed.
|
||||||
|
|
||||||
|
Baremetal scheduling will use the custom resource class defined for
|
||||||
|
each baremetal node to make its selection. Refer to the ironic
|
||||||
|
documentation for more details:
|
||||||
|
|
||||||
|
https://docs.openstack.org/ironic/latest/install/configure-nova-flavors.html#scheduling-resource-classes
|
Loading…
x
Reference in New Issue
Block a user