Track provider traits in report client

With this change, SchedulerReportClient keeps track of resource provider
traits in the same way as aggregates.  Specifically:

- We use ProviderTree methods to save trait information for each
  provider.
- We refresh trait information along with aggregate information whenever
  we "ensure" a provider exists.

Note that this change set consolidates the refreshing (including cache
expiry) of aggregate and trait associations into a single method.  The
theory being that both aggregate associations and trait associations
should change out of band with roughly the same frequency (i.e. very
rarely).

Change-Id: I33d01d8cab43ce6cdde151d2e9429921a140e88d
This commit is contained in:
Eric Fried 2017-11-20 17:20:51 -06:00
parent d1875b28d9
commit 6e4936a16c

View File

@ -116,13 +116,16 @@ class SchedulerReportClientTests(test.TestCase):
rps = self.client._get_providers_in_tree(self.compute_uuid)
self.assertEqual(1, len(rps))
# We should also have an empty list set of aggregate UUID
# We should also have empty sets of aggregate and trait
# associations
self.assertEqual(
[], self.client._get_providers_in_aggregates([uuids.agg]))
self.assertFalse(
self.client._provider_tree.have_aggregates_changed(
self.compute_uuid, []))
self.assertFalse(
self.client._provider_tree.have_traits_changed(
self.compute_uuid, []))
# TODO(cdent): change this to use the methods built in
# to the report client to retrieve inventory?