OpenStack: count leaked nodes in unmanaged quota
If a node has leaked, it won't be counted against quota because it's still recognized as belonging to the nodepool provider so it doesn't count against unmanaged quota, however, there is no zk record for it, so it also isn't counted against managed quota. This throws quota calculations off for as long as the leaked instances exist in nova. To correct this, count leaked nodes against unmanaged quota. Change-Id: I5a658649b881ed80b777096ec48cb6207f2a9cc6
This commit is contained in:
parent
81936cd818
commit
56164c886a
|
@ -182,15 +182,21 @@ class OpenStackProvider(Provider):
|
|||
flavors = self.listFlavorsById()
|
||||
used_quota = QuotaInformation()
|
||||
|
||||
node_ids = set([n.id for n in self._zk.nodeIterator()])
|
||||
|
||||
for server in self.listNodes():
|
||||
meta = server.get('metadata', {})
|
||||
|
||||
nodepool_provider_name = meta.get('nodepool_provider_name')
|
||||
if nodepool_provider_name and \
|
||||
nodepool_provider_name == self.provider.name:
|
||||
# This provider (regardless of the launcher) owns this server
|
||||
# so it must not be accounted for unmanaged quota.
|
||||
continue
|
||||
if (nodepool_provider_name and
|
||||
nodepool_provider_name == self.provider.name):
|
||||
# This provider (regardless of the launcher) owns this
|
||||
# server so it must not be accounted for unmanaged
|
||||
# quota; unless it has leaked.
|
||||
nodepool_node_id = meta.get('nodepool_node_id')
|
||||
if not (nodepool_node_id and nodepool_node_id in node_ids):
|
||||
# It has not leaked.
|
||||
continue
|
||||
|
||||
flavor = flavors.get(server.flavor.id)
|
||||
used_quota.add(QuotaInformation.construct_from_flavor(flavor))
|
||||
|
|
Loading…
Reference in New Issue