Merge "Fail quickly for disabled provider pools"

This commit is contained in:
Zuul 2018-06-11 13:35:19 +00:00 committed by Gerrit Code Review
commit 65fef3a07d
1 changed files with 6 additions and 3 deletions

View File

@ -463,14 +463,17 @@ class NodeRequestHandler(object, metaclass=abc.ABCMeta):
declined_reasons = []
invalid_types = self._invalidNodeTypes()
if invalid_types:
if self.pool.max_servers <= 0:
declined_reasons.append('pool is disabled by max_servers')
elif invalid_types:
declined_reasons.append('node type(s) [%s] not available' %
','.join(invalid_types))
elif not self.imagesAvailable():
declined_reasons.append('images are not available')
elif (self.pool.max_servers <= 0 or
not self.hasProviderQuota(self.request.node_types)):
elif not self.hasProviderQuota(self.request.node_types):
declined_reasons.append('it would exceed quota')
# TODO(tobiash): Maybe also calculate the quota prediction here and
# backoff for some seconds if the used quota would be exceeded?
# This way we could give another (free) provider the chance to take