Handle node no longer in pool error

When the configuration changes such that the labels of existing
nodes are no longer in a pool, quota calculation fails because
we assume we can't have values in zk which don't match the config.
Handle that case explicitly so that we don't throw an exception.

Change-Id: Ib934cd56ae423d7ecff7edf0d13d33fc05bc757b
This commit is contained in:
James E. Blair 2018-06-29 16:12:34 -07:00
parent 554d64dc98
commit d610cb1c35
1 changed files with 7 additions and 0 deletions

View File

@ -159,6 +159,13 @@ class OpenStackProvider(Provider):
# but move on and don't account it as we can't properly
# calculate its cost without pool info.
continue
if node.type[0] not in provider_pool.labels:
self.log.warning(
"Node type is not in provider pool for node %s" % node)
# This node is also in a funny state; the config
# may have changed under it. It should settle out
# eventually when it's deleted.
continue
node_resources = self.quotaNeededByNodeType(
node.type[0], provider_pool)
used_quota.add(node_resources)