Avoid passing empty aggregates to Placement
This adds a check before constructing member_of parameters to avoid passing empty aggregates list to placement. Also this changes to only get aggregates with affinity_zone during server group scheduling. Change-Id: Ic282d5afcad5fa78fdb029e874c78ac10cd73153
This commit is contained in:
parent
896eed5dea
commit
4d8cdb3992
@ -125,6 +125,8 @@ class FilterScheduler(driver.Scheduler):
|
||||
return server_group
|
||||
|
||||
def _get_nodes_of_aggregates(self, aggregates):
|
||||
if not aggregates:
|
||||
return []
|
||||
agg_uuids = [agg.uuid for agg in aggregates]
|
||||
query_filters = {'member_of': 'in:' + ','.join(agg_uuids)}
|
||||
rps = self.reportclient.get_filtered_resource_providers(query_filters)
|
||||
@ -171,7 +173,8 @@ class FilterScheduler(driver.Scheduler):
|
||||
_log_and_raise_error('affinity')
|
||||
return selected_affz, selected_nodes[:num_servers]
|
||||
|
||||
all_aggs = objects.AggregateList.get_all(context)
|
||||
all_aggs = objects.AggregateList.get_by_metadata_key(
|
||||
context, 'affinity_zone')
|
||||
all_aggs = sorted(all_aggs, key=lambda a: a.metadata.get(
|
||||
'affinity_zone'))
|
||||
grouped_aggs = itertools.groupby(
|
||||
|
Loading…
Reference in New Issue
Block a user