Optimize list_servers call in cleanupLeakedInstances

By default list_servers gets the server list and then attaches the
network information to each server object. This involves a call to the
floatingips endpoint per instance. This is unneeded during
cleanupLeakedInstances since we're only interested in the id and
metadata in order to trigger node deletion. In larger clouds this can
trigger hundreds or thousands unnecessary api calls to the
cloud. Optimize this by getting the server list with the bare flag to
avoid that.

Change-Id: Ie48e647eefc2aa3169e943fdf6854d82219b645b
This commit is contained in:
Tobias Henkel
2021-02-16 11:21:40 +01:00
parent 2e59f7b0b3
commit b51a8be1ba

View File

@@ -463,7 +463,7 @@ class OpenStackProvider(Provider, QuotaSupport):
deleting_nodes[node.provider] = []
deleting_nodes[node.provider].append(node.external_id)
for server in self.listNodes():
for server in self._client.list_servers(bare=True):
meta = server.get('metadata', {})
if 'nodepool_provider_name' not in meta: