From 6e4936a16ca4979ab9d8deaf6c32418d0e7c5b58 Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Mon, 20 Nov 2017 17:20:51 -0600 Subject: [PATCH] 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 --- .../functional/api/openstack/placement/test_report_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/tests/functional/api/openstack/placement/test_report_client.py b/nova/tests/functional/api/openstack/placement/test_report_client.py index 32825568c..d35fb31d8 100644 --- a/nova/tests/functional/api/openstack/placement/test_report_client.py +++ b/nova/tests/functional/api/openstack/placement/test_report_client.py @@ -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?