Fix batching for floating ips and ports

When cache settings are in place for ports and floating ips, we should
be doing full list calls and filtering locally. This is done to prevent
things lke nodepool from crushing clouds under the weight of our immense
need for information.

Change-Id: I304ff1c0e355bcfc00398316a296417c19e9b74f
This commit is contained in:
Monty Taylor 2017-12-06 11:06:47 -06:00
parent faaf5f024b
commit cd6da8a04d
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 7 additions and 4 deletions

View File

@ -1764,9 +1764,11 @@ class OpenStackCloud(
:returns: A list of port ``munch.Munch``.
"""
# If pushdown filters are specified, bypass local caching.
if filters:
# If pushdown filters are specified and we do not have batched caching
# enabled, bypass local caching and push down the filters.
if filters and self._PORT_AGE == 0:
return self._list_ports(filters)
# Translate None from search interface to empty {} for kwargs below
filters = {}
if (time.time() - self._ports_time) >= self._PORT_AGE:
@ -2364,8 +2366,9 @@ class OpenStackCloud(
:returns: A list of floating IP ``munch.Munch``.
"""
# If pushdown filters are specified, bypass local caching.
if filters:
# If pushdown filters are specified and we do not have batched caching
# enabled, bypass local caching and push down the filters.
if filters and self._FLOAT_AGE == 0:
return self._list_floating_ips(filters)
if (time.time() - self._floating_ips_time) >= self._FLOAT_AGE: