Remove MEMOIZE from get_pod_ip

get_pod_ip() does not make any API calls and just gets the IP from VIF
annotation. Maybe it would make some sense to cache it to avoid several
dict lookups, but current version bases cache on whole pod object, which
we know may change often over time, so I don't think there's a point in
keeping the cache here.

Change-Id: Id441700ac7add94a675c3a38434abae0b826b766
This commit is contained in:
Michał Dulko 2020-04-03 13:26:56 +02:00
parent 01ef4ee19c
commit ecda137ddc
1 changed files with 0 additions and 16 deletions

View File

@ -16,7 +16,6 @@
import urllib
from openstack import exceptions as os_exc
from oslo_cache import core as cache
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
@ -34,20 +33,6 @@ LOG = log.getLogger(__name__)
CONF = cfg.CONF
pod_ip_caching_opts = [
cfg.BoolOpt('caching', default=True),
cfg.IntOpt('cache_time', default=3600),
]
CONF.register_opts(pod_ip_caching_opts, "pod_ip_caching")
cache.configure(CONF)
pod_ip_cache_region = cache.create_region()
MEMOIZE = cache.get_memoization_decorator(
CONF, pod_ip_cache_region, "pod_ip_caching")
cache.configure_cache_region(CONF, pod_ip_cache_region)
def get_network_id(subnets):
ids = list(set(net.id for net in subnets.values()))
@ -275,7 +260,6 @@ def create_security_group_rule_body(
return security_group_rule_body
@MEMOIZE
def get_pod_ip(pod):
try:
pod_metadata = pod['metadata']['annotations']