summaryrefslogtreecommitdiff
path: root/nova/availability_zones.py
diff options
context:
space:
mode:
authorDavanum Srinivas <davanum@gmail.com>2016-01-29 12:50:58 -0500
committerDavanum Srinivas <davanum@gmail.com>2016-02-02 08:20:13 -0500
commit205fb7c8b34e521bdc14b5c3698d1597753b27d4 (patch)
tree9a4c1cf34d42d44c37cde871c1c8e8050b89f068 /nova/availability_zones.py
parent5eed75332fe2cbc5ecda0fc0724abbc886d249bd (diff)
downloadnova-205fb7c8b34e521bdc14b5c3698d1597753b27d4.tar.gz
Switch to oslo.cache lib
Common memorycache was replaced by analogous tool from oslo.cache lib. In-memory cache was replaced by oslo.cache.dict backend. Memcached was replaced by dogpile.cache.memcached backend. Implements blueprint oslo-for-mitaka Closes-Bug: #1483322 Co-Authored-By: Sergey Nikitin <snikitin@mirantis.com> Co-Authored-By: Pavel Kholkin <pkholkin@mirantis.com> Change-Id: I371f7a68e6a6c1c4cd101f61b9ad96c15187a80e
Diffstat (limited to 'nova/availability_zones.py')
-rw-r--r--nova/availability_zones.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/availability_zones.py b/nova/availability_zones.py
index dbd8697c37..26aed25468 100644
--- a/nova/availability_zones.py
+++ b/nova/availability_zones.py
@@ -19,8 +19,8 @@ import collections
from oslo_config import cfg
+from nova import cache_utils
from nova import objects
-from nova.openstack.common import memorycache
# NOTE(vish): azs don't change that often, so cache them for an hour to
# avoid hitting the db multiple times on every request.
@@ -44,7 +44,7 @@ def _get_cache():
global MC
if MC is None:
- MC = memorycache.get_client()
+ MC = cache_utils.get_client(expiration_time=AZ_CACHE_SECONDS)
return MC
@@ -113,7 +113,7 @@ def update_host_availability_zone_cache(context, host, availability_zone=None):
cache = _get_cache()
cache_key = _make_cache_key(host)
cache.delete(cache_key)
- cache.set(cache_key, availability_zone, AZ_CACHE_SECONDS)
+ cache.set(cache_key, availability_zone)
def get_availability_zones(context, get_only_available=False,
@@ -195,5 +195,5 @@ def get_instance_availability_zone(context, instance):
if not az:
elevated = context.elevated()
az = get_host_availability_zone(elevated, host)
- cache.set(cache_key, az, AZ_CACHE_SECONDS)
+ cache.set(cache_key, az)
return az