From cd6da8a04d994ed3e4acb27e9b18c122f8875100 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 6 Dec 2017 11:06:47 -0600 Subject: [PATCH] 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 --- shade/openstackcloud.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py index 28ed2e543..1b4c961d2 100644 --- a/shade/openstackcloud.py +++ b/shade/openstackcloud.py @@ -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: