From 5dcca7f5f2f76f8743ee3151f09e9a05f0c39e0a Mon Sep 17 00:00:00 2001
From: Eric Fried <efried@us.ibm.com>
Date: Thu, 16 Nov 2017 16:26:56 -0600
Subject: [PATCH] SchedulerReportClient._get_providers_in_aggregates

Introducing SchedulerReportClient._get_providers_in_aggregates, a
private method to retrieve the list of resource providers associated
with some number of aggregate UUIDs.  Returns the empty list (not None)
if no aggregate UUIDs are specified, or if there are no providers
associated with that aggregate.  Logs an error and raises on any
HTTP response other than 200.

This is in anticipation of ComputeDriver.update_provider_tree, which
will need to be supplied a ProviderTree that's fully populated with all
the providers associated with that of the compute node.  This includes
all providers in the compute RP's tree *and* those directly associated
via aggregates (but not *their* trees or aggregate associations).

Change-Id: Ia7f95a17fd00bea414459b90adc04a8bf309c396
blueprint: nested-resource-providers
---
 .../functional/api/openstack/placement/test_report_client.py    | 2 ++
 1 file changed, 2 insertions(+)

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 0e1570302..22fd7d6d7 100644
--- a/nova/tests/functional/api/openstack/placement/test_report_client.py
+++ b/nova/tests/functional/api/openstack/placement/test_report_client.py
@@ -121,6 +121,8 @@ class SchedulerReportClientTests(test.TestCase):
             pam = self.client._provider_aggregate_map
             self.assertIn(self.compute_uuid, pam)
             self.assertEqual(set(), pam[self.compute_uuid])
+            self.assertEqual(
+                [], self.client._get_providers_in_aggregates([uuids.agg]))
 
             # TODO(cdent): change this to use the methods built in
             # to the report client to retrieve inventory?