Use quota handling code for min-ready declines
We currently check the current pool nodes against max_servers in order to decline min-ready request when we're at quota. This is older than the quota handling where max-servers was the only limiting thing. Now we have real quota handling we should defer this min-ready check to the point where we know that we're at quota (independent of self defined pool quota or real cloud quota). Change-Id: Ic36ecfaf441436db6699297ef459c586f14c2dfc
This commit is contained in:
parent
32b8f58df0
commit
552cc28f7f
@ -413,7 +413,10 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
|
|||||||
diff = requested_types - saved_types
|
diff = requested_types - saved_types
|
||||||
needed_types = list(diff.elements())
|
needed_types = list(diff.elements())
|
||||||
|
|
||||||
ready_nodes = self.zk.getReadyNodesOfTypes(needed_types)
|
if self.request.reuse:
|
||||||
|
ready_nodes = self.zk.getReadyNodesOfTypes(needed_types)
|
||||||
|
else:
|
||||||
|
ready_nodes = []
|
||||||
|
|
||||||
for ntype in needed_types:
|
for ntype in needed_types:
|
||||||
# First try to grab from the list of already available nodes.
|
# First try to grab from the list of already available nodes.
|
||||||
@ -455,6 +458,20 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
|
|||||||
# If we calculate that we're at capacity, pause until nodes
|
# If we calculate that we're at capacity, pause until nodes
|
||||||
# are released by Zuul and removed by the DeletedNodeWorker.
|
# are released by Zuul and removed by the DeletedNodeWorker.
|
||||||
if not self.hasRemainingQuota(ntype):
|
if not self.hasRemainingQuota(ntype):
|
||||||
|
|
||||||
|
if self.request.requestor == "NodePool:min-ready":
|
||||||
|
# The point of the min-ready nodes is to have nodes on
|
||||||
|
# standby for future requests. When at capacity, it
|
||||||
|
# doesn't make sense to wait for and use resources to
|
||||||
|
# speculatively create a node. Decline this so someone
|
||||||
|
# else with capacity can take it.
|
||||||
|
self.log.debug(
|
||||||
|
"Declining node request %s because provider cannot"
|
||||||
|
" satisfy min-ready")
|
||||||
|
self.decline_request()
|
||||||
|
self._declinedHandlerCleanup()
|
||||||
|
return
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"Not enough quota remaining to satisfy request %s",
|
"Not enough quota remaining to satisfy request %s",
|
||||||
self.request.id)
|
self.request.id)
|
||||||
@ -531,19 +548,6 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
|
|||||||
# This way we could give another (free) provider the chance to take
|
# This way we could give another (free) provider the chance to take
|
||||||
# this request earlier.
|
# this request earlier.
|
||||||
|
|
||||||
# For min-ready requests, which do not re-use READY nodes, let's
|
|
||||||
# decline if this provider is already at capacity. Otherwise, we
|
|
||||||
# could end up wedged until another request frees up a node.
|
|
||||||
if self.pool.max_servers is not None and \
|
|
||||||
self.request.requestor == "NodePool:min-ready":
|
|
||||||
current_count = self.zk.countPoolNodes(self.provider.name,
|
|
||||||
self.pool.name)
|
|
||||||
# Use >= because dynamic config changes to max-servers can leave
|
|
||||||
# us with more than max-servers.
|
|
||||||
# TODO: handle this with the quota code
|
|
||||||
if current_count >= self.pool.max_servers:
|
|
||||||
declined_reasons.append("provider cannot satisfy min-ready")
|
|
||||||
|
|
||||||
if declined_reasons:
|
if declined_reasons:
|
||||||
self.log.debug("Declining node request %s because %s",
|
self.log.debug("Declining node request %s because %s",
|
||||||
self.request.id, ', '.join(declined_reasons))
|
self.request.id, ', '.join(declined_reasons))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user