Merge "Fix batching for floating ips and ports"

This commit is contained in:
Zuul 2017-12-07 21:25:08 +00:00 committed by Gerrit Code Review
commit 3b3cc08d01
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: