diff options
author | Mark McLoughlin <markmc@redhat.com> | 2013-01-08 09:18:11 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-01-09 22:09:17 +0000 |
commit | 562b5a452db7208b53022aba0e8b6a8f70150587 (patch) | |
tree | 9b7d75e4aec93b79641310455b1b86b5a24eaceb /nova/api/metadata/handler.py | |
parent | d8c80c6b14c29dbea21ce045adce82ac92708fa3 (diff) | |
download | nova-562b5a452db7208b53022aba0e8b6a8f70150587.tar.gz nova-562b5a452db7208b53022aba0e8b6a8f70150587.tar.xz nova-562b5a452db7208b53022aba0e8b6a8f70150587.zip |
Move memcached_servers opt into common.memorycache
Add a factory function to nova.common.memorycache which consolidates
the code to choose between real or fake memcache. This then means that
memcached_servers is used in just one place and we can move the config
option there.
blueprint: scope-config-opts
Change-Id: I67c191e0db58364eda4162b9e881606063509b9d
Diffstat (limited to 'nova/api/metadata/handler.py')
-rw-r--r-- | nova/api/metadata/handler.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index b164c5fea..fbb46930b 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -25,6 +25,7 @@ import webob.dec import webob.exc from nova.api.metadata import base +from nova.common import memorycache from nova import exception from nova.openstack.common import cfg from nova.openstack.common import log as logging @@ -33,7 +34,6 @@ from nova import wsgi CACHE_EXPIRATION = 15 # in seconds CONF = cfg.CONF -CONF.import_opt('memcached_servers', 'nova.config') CONF.import_opt('use_forwarded_for', 'nova.api.auth') metadata_proxy_opts = [ @@ -52,17 +52,12 @@ CONF.register_opts(metadata_proxy_opts) LOG = logging.getLogger(__name__) -if CONF.memcached_servers: - import memcache -else: - from nova.common import memorycache as memcache - class MetadataRequestHandler(wsgi.Application): """Serve metadata.""" def __init__(self): - self._cache = memcache.Client(CONF.memcached_servers, debug=0) + self._cache = memorycache.get_client() def get_metadata_by_remote_address(self, address): if not address: |