Handle AggregateNotFound when deleting aggregate

If an error occurs during lease create and an aggregate isn't created,
an exception will be raised in cleanup_resources when trying to delete
the missing aggregate. Handle this gracefully and continue.

Closes-Bug: #1938241

Change-Id: I866bc7c369fb390f8c9204e36c06fadea17f6dd5
This commit is contained in:
Sam Morrison 2021-07-28 13:35:47 +10:00 committed by Pierre Riteau
parent 63d94170b5
commit 339e91342d
1 changed files with 5 additions and 1 deletions

View File

@ -278,7 +278,11 @@ class ReservationPool(NovaClientWrapper):
"""
agg = self.get_aggregate_from_name_or_id(pool)
try:
agg = self.get_aggregate_from_name_or_id(pool)
except manager_exceptions.AggregateNotFound:
LOG.warn("Aggregate '%s' not found, skipping deletion", pool)
return
hosts = agg.hosts
if len(hosts) > 0 and not force: