mirror nova host aggregate members to placement

This patch is the first step in syncing the nova host aggregate
information with the placement service. The scheduler report client gets
a couple new public methods -- aggregate_add_host() and
aggregate_remove_host(). Both of these methods do **NOT** impact the
provider tree cache that the scheduler reportclient keeps when
instantiated inside the compute resource tracker.

Instead, these two new reportclient methods look up a resource provider
by *name* (not UUID) since that is what is supplied by the
os-aggregates Compute API when adding or removing a "host" to/from a
nova host aggregate.

Change-Id: Ibd7aa4f8c4ea787774becece324d9051521c44b6
blueprint: placement-mirror-host-aggregates
This commit is contained in:
Jay Pipes
2018-03-15 15:53:27 -04:00
parent 355c8b53ab
commit fa794372be
3 changed files with 29 additions and 16 deletions

View File

@@ -293,10 +293,11 @@ Rocky (18.0.0)
that service. This is because the ``nova-api`` service now needs to talk
to the placement service in order to (1) delete resource provider allocations
when deleting an instance and the ``nova-compute`` service on which that
instance is running is down and (2) delete a ``nova-compute`` service record
via the ``DELETE /os-services/{service_id}`` API. This change is idempotent
if ``[placement]`` is not configured in ``nova-api`` but it will result in
new warnings in the logs until configured.
instance is running is down (2) delete a ``nova-compute`` service record via
the ``DELETE /os-services/{service_id}`` API and (3) mirror aggregate host
associations to the placement service. This change is idempotent if
``[placement]`` is not configured in ``nova-api`` but it will result in new
warnings in the logs until configured.
REST API
========

View File

@@ -141,20 +141,11 @@ class AggregateRequestFiltersTest(test.TestCase,
host_uuid = self._get_provider_uuid_by_host(host)
# Get the existing aggregates for this host in placement and add the
# new one to it
aggs = self.report_client.get(
'/resource_providers/%s/aggregates' % host_uuid,
version='1.1').json()
placement_aggs = aggs['aggregates']
placement_aggs.append(agg['uuid'])
# Make sure we have a view of the provider we're about to mess with
# FIXME(efried): This should be a thing we can do without internals
self.report_client._ensure_resource_provider(self.context, host_uuid)
self.report_client.set_aggregates_for_provider(self.context, host_uuid,
placement_aggs)
self.report_client._ensure_resource_provider(
self.context, host_uuid, name=host)
self.report_client.aggregate_add_host(self.context, agg['uuid'], host)
def _wait_for_state_change(self, server, from_status):
for i in range(0, 50):

View File

@@ -0,0 +1,21 @@
---
features:
- |
We now attempt to mirror the association of compute host to host aggregate
into the placement API. When administrators use the ``POST
/os-aggregates/{aggregate_id}/action`` Compute API call to add or remove a
host from an aggregate, the nova-api service will attempt to ensure that a
corresponding record is created in the placement API for the resource
provider (compute host) and host aggregate UUID.
The nova-api service needs to understand how to connect to the placement
service in order for this mirroring process to work. Administrators should
ensure that there is a ``[placement]`` section in the nova.conf file which
is used by the nova-api service, and that credentials for interacting with
placement are contained in that section.
If the ``[placement]`` section is missing from the nova-api's nova.conf
file, nothing will break however there will be some warnings generated in
the nova-api's log file when administrators associate a compute host with a
host aggregate. However, this will become a failure starting in the 19.0.0
Stein release.