Merge "Introduce error.capacity states_key for InsufficientInstanceCapacity error"

This commit is contained in:
Zuul 2024-02-08 08:23:17 +00:00 committed by Gerrit Code Review
commit 7abd12906f
2 changed files with 10 additions and 0 deletions

View File

@ -1120,6 +1120,12 @@ class AwsAdapter(statemachine.Adapter):
# Re-raise as a quota exception so that the
# statemachine driver resets quota.
raise exceptions.QuotaException(str(error))
if (error.response['Error']['Code'] ==
'InsufficientInstanceCapacity'):
# Re-raise as CapacityException so it would have
# "error.capacity" statsd_key, which can be handled
# differently than "error.unknown"
raise exceptions.CapacityException(str(error))
raise
def _createInstance(self, label, image_external_id,

View File

@ -31,6 +31,10 @@ class LaunchKeyscanException(Exception):
statsd_key = 'error.keyscan'
class CapacityException(Exception):
statsd_key = 'error.capacity'
class BuilderError(RuntimeError):
pass