Beispiel #1
0
def _get_cache():
    global MC

    if MC is None:
        MC = memorycache.get_client()

    return MC
Beispiel #2
0
def _get_cache():
    global MC

    if MC is None:
        MC = memorycache.get_client()

    return MC
Beispiel #3
0
Datei: mc.py Projekt: pubfox/nova
 def __init__(self, *args, **kwargs):
     test = kwargs.get('test')
     if not CONF.memcached_servers and not test:
         raise RuntimeError(_('memcached_servers not defined'))
     self.mc = memorycache.get_client()
     self.db_allowed = kwargs.get('db_allowed', True)
     self.conductor_api = conductor.API(use_local=self.db_allowed)
Beispiel #4
0
 def __init__(self, scheduler_driver=None, *args, **kwargs):
     super(ConsoleAuthManager, self).__init__(service_name='consoleauth',
                                              *args,
                                              **kwargs)
     self.mc = memorycache.get_client()
     self.compute_rpcapi = compute_rpcapi.ComputeAPI()
     self.cells_rpcapi = cells_rpcapi.CellsAPI()
Beispiel #5
0
 def __init__(self, *args, **kwargs):
     test = kwargs.get('test')
     if not CONF.memcached_servers and not test:
         raise RuntimeError(_('memcached_servers not defined'))
     self.mc = memorycache.get_client()
     self.db_allowed = kwargs.get('db_allowed', True)
     self.conductor_api = conductor.API(use_local=self.db_allowed)
Beispiel #6
0
 def memoizer(context, reqid):
     global _CACHE
     if not _CACHE:
         _CACHE = memorycache.get_client()
     key = "%s:%s" % (func.__name__, reqid)
     value = _CACHE.get(key)
     if value is None:
         value = func(context, reqid)
         _CACHE.set(key, value, time=_CACHE_TIME)
     return value
Beispiel #7
0
 def memoizer(context, reqid):
     global _CACHE
     if not _CACHE:
         _CACHE = memorycache.get_client()
     key = "%s:%s" % (func.__name__, reqid)
     value = _CACHE.get(key)
     if value is None:
         value = func(context, reqid)
         _CACHE.set(key, value, time=_CACHE_TIME)
     return value
Beispiel #8
0
 def __init__(self, application):
     """middleware can use fake for testing."""
     self.mc = memorycache.get_client()
     super(Lockout, self).__init__(application)
Beispiel #9
0
 def __init__(self):
     self._cache = memorycache.get_client()
     self.conductor_api = conductor.API()
Beispiel #10
0
 def __init__(self, application):
     """middleware can use fake for testing."""
     self.mc = memorycache.get_client()
     super(Lockout, self).__init__(application)
Beispiel #11
0
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""Availability zone helper functions."""

from oslo.config import cfg

from nova import db
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.
AZ_CACHE_SECONDS = 60 * 60
MC = memorycache.get_client()

availability_zone_opts = [
    cfg.StrOpt('internal_service_availability_zone',
               default='internal',
               help='availability_zone to show internal services under'),
    cfg.StrOpt('default_availability_zone',
               default='nova',
               help='default compute node availability_zone'),
    ]

CONF = cfg.CONF
CONF.register_opts(availability_zone_opts)


def set_availability_zones(context, services):
 def __init__(self):
     self.mc = memorycache.get_client()
Beispiel #13
0
 def __init__(self, scheduler_driver=None, *args, **kwargs):
     super(ConsoleAuthManager, self).__init__(service_name='consoleauth',
                                              *args, **kwargs)
     self.mc = memorycache.get_client()
     self.compute_rpcapi = compute_rpcapi.ComputeAPI()
     self.cells_rpcapi = cells_rpcapi.CellsAPI()
Beispiel #14
0
 def __init__(self, *args, **kwargs):
     if not CONF.memcached_servers:
         raise RuntimeError(_('memcached_servers not defined'))
     self.mc = memorycache.get_client()
Beispiel #15
0
 def __init__(self, *args, **kwargs):
     if not CONF.memcached_servers:
         raise RuntimeError(_('memcached_servers not defined'))
     self.mc = memorycache.get_client()
Beispiel #16
0
 def __init__(self, scheduler_driver=None, *args, **kwargs):
     super(ConsoleAuthManager, self).__init__(*args, **kwargs)
     self.mc = memorycache.get_client()
     self.compute_rpcapi = compute_rpcapi.ComputeAPI()
     self.conductor_api = conductor_api.API()
Beispiel #17
0
 def __init__(self):
     self._cache = memorycache.get_client()
Beispiel #18
0
 def __init__(self, scheduler_driver=None, *args, **kwargs):
     super(ConsoleAuthManager, self).__init__(*args, **kwargs)
     self.mc = memorycache.get_client()
     self.compute_rpcapi = compute_rpcapi.ComputeAPI()
     self.conductor_api = conductor_api.API()