diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-10 05:35:46 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-10 05:35:46 +0000 |
| commit | 9383329eb664b969ed367b8aa7f78e3ef0ad72dd (patch) | |
| tree | 02597ac13eed511c85834ef9082f8a83da9ee70b /nova/api | |
| parent | 7a0bed371ecbd7cc7026fee8b8148f48c7be82e9 (diff) | |
| parent | 562b5a452db7208b53022aba0e8b6a8f70150587 (diff) | |
Merge "Move memcached_servers opt into common.memorycache"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 9 | ||||
| -rw-r--r-- | nova/api/metadata/handler.py | 9 |
2 files changed, 4 insertions, 14 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index b7742a53c..7cd7e1c7d 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -31,6 +31,7 @@ from nova.api.ec2 import apirequest from nova.api.ec2 import ec2utils from nova.api.ec2 import faults from nova.api import validator +from nova.common import memorycache from nova import context from nova import exception from nova.openstack.common import cfg @@ -72,7 +73,6 @@ ec2_opts = [ CONF = cfg.CONF CONF.register_opts(ec2_opts) -CONF.import_opt('memcached_servers', 'nova.config') CONF.import_opt('use_forwarded_for', 'nova.api.auth') @@ -162,12 +162,7 @@ class Lockout(wsgi.Middleware): def __init__(self, application): """middleware can use fake for testing.""" - if CONF.memcached_servers: - import memcache - else: - from nova.common import memorycache as memcache - self.mc = memcache.Client(CONF.memcached_servers, - debug=0) + self.mc = memorycache.get_client() super(Lockout, self).__init__(application) @webob.dec.wsgify(RequestClass=wsgi.Request) 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: |
