Remove service version check for Ocata/Newton placement decisions

In Ocata, the filter scheduler would not consult placement until all of
the computes had been upgraded. That check no longer makes sense in Pike
and isn't multi-cell-aware anyway. This removes that check.

Change-Id: Ia1a0066dc30025c02553584a077365b28d8ff80e
This commit is contained in:
Dan Smith 2017-02-20 11:49:01 -08:00
parent 9a44d56f65
commit c604a6cf16
4 changed files with 14 additions and 29 deletions

View File

@ -186,6 +186,13 @@ Ocata (15.0.0)
* Users of CellsV1 will need to deploy a placement per cell, matching
the scope and cardinality of the regular ``nova-scheduler`` process.
Pike (16.0.0)
~~~~~~~~~~~~~
* The ``nova.scheduler.filter_scheduler.FilterScheduler`` in Pike will
no longer fall back to not using the Placement Service, even if older
computes are running in the deployment.
REST API
========

View File

@ -27,7 +27,6 @@ from six.moves import range
import nova.conf
from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import fields
from nova import rpc
from nova.scheduler import client as scheduler_client
@ -166,18 +165,6 @@ class FilterScheduler(driver.Scheduler):
def _get_all_host_states(self, context, spec_obj):
"""Template method, so a subclass can implement caching."""
# NOTE(sbauza): Since Newton compute nodes require a configuration
# change to request the Placement API, and given it goes against
# our rolling upgrade process, we define a graceful period for allowing
# clouds that are not fully upgraded to Ocata to still be able to
# have instances being scheduled on old nodes.
service_version = objects.Service.get_minimum_version(
context, 'nova-compute')
# TODO(sbauza): Remove that version check in Pike so we fully call
# the placement API anyway.
if service_version < 16:
LOG.debug("Skipping call to placement, as upgrade in progress.")
return self.host_manager.get_all_host_states(context)
filters = {'resources': self._get_resources_per_request_spec(spec_obj)}
reportclient = self.scheduler_client.reportclient
rps = reportclient.get_filtered_resource_providers(filters)

View File

@ -262,18 +262,6 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
self.assertEqual(50, hosts[0].weight)
# TODO(sbauza): Remove that unit test in Pike
@mock.patch('nova.objects.Service.get_minimum_version',
return_value=15)
def test_get_all_host_states_with_newton_computes(self, mock_get_mv):
"""If at least one compute node is older than Ocata, then we should
not call the placement API.
"""
with mock.patch.object(self.driver.host_manager,
'get_all_host_states') as mock_get_hosts:
self.driver._get_all_host_states(self.context, mock.sentinel.spec)
mock_get_hosts.assert_called_once_with(self.context)
@mock.patch('nova.objects.ServiceList.get_by_binary',
return_value=fakes.SERVICES)
@mock.patch('nova.objects.InstanceList.get_by_host')
@ -282,12 +270,10 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.'
'get_filtered_resource_providers',
return_value=fakes.RESOURCE_PROVIDERS)
@mock.patch('nova.objects.Service.get_minimum_version',
return_value=objects.service.SERVICE_VERSION)
@mock.patch('nova.db.instance_extra_get_by_instance_uuid',
return_value={'numa_topology': None,
'pci_requests': None})
def test_select_destinations(self, mock_get_extra, mock_get_mv,
def test_select_destinations(self, mock_get_extra,
mock_get_rps, mock_get_all,
mock_by_host, mock_get_by_binary):
"""select_destinations is basically a wrapper around _schedule().
@ -333,7 +319,6 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
(host, node) = (dests[0]['host'], dests[0]['nodename'])
self.assertEqual(host, selected_hosts[0])
self.assertEqual(node, selected_nodes[0])
mock_get_mv.assert_called_once_with(mock.ANY, 'nova-compute')
@mock.patch.object(filter_scheduler.FilterScheduler, '_schedule')
def test_select_destinations_notifications(self, mock_schedule):

View File

@ -0,0 +1,6 @@
---
upgrade:
- In Ocata, the nova-scheduler would fall back to not calling the
placement service during instance boot if old computes were
running. That compatibility mode is no longer present in Pike, and
as such, the scheduler fully depends on the placement service.