Beispiel #1
0
    def __init__(self, *args, **kwargs):
        LOG.debug(_('QuotaManager initialization...'))

        super(QuotaManager, self).__init__(service_name="quota_manager",
                                           *args, **kwargs)
        self.context = context.get_admin_context()
        self.endpoints = endpoint_cache.EndpointCache()
Beispiel #2
0
 def service_registry_report(self):
     ctx = context.get_admin_context()
     try:
         svc = service_obj.Service.update(ctx, self.engine_id)
         # if svc is None, means it's not created.
         if svc is None:
             service_obj.Service.create(ctx, self.engine_id, self.host,
                                        'kingbird-engine', self.topic)
     except Exception as ex:
         LOG.error(_LE('Service %(service_id)s update failed: %(error)s'),
                   {'service_id': self.engine_id, 'error': ex})
Beispiel #3
0
 def service_registry_cleanup(self):
     ctx = context.get_admin_context()
     time_window = (2 * cfg.CONF.report_interval)
     services = service_obj.Service.get_all(ctx)
     for svc in services:
         if svc['id'] == self.engine_id:
             continue
         if timeutils.is_older_than(svc['updated_at'], time_window):
             # < time_line:
             # hasn't been updated, assuming it's died.
             LOG.info(_LI('Service %s was aborted'), svc['id'])
             service_obj.Service.delete(ctx, svc['id'])
Beispiel #4
0
 def service_registry_cleanup(self):
     ctx = context.get_admin_context()
     time_window = (2 * cfg.CONF.report_interval)
     services = service_obj.Service.get_all(ctx)
     for svc in services:
         if svc['id'] == self.engine_id:
             continue
         if timeutils.is_older_than(svc['updated_at'], time_window):
             # < time_line:
             # hasn't been updated, assuming it's died.
             LOG.info('Service %s was aborted', svc['id'])
             service_obj.Service.delete(ctx, svc['id'])
Beispiel #5
0
 def service_registry_report(self):
     ctx = context.get_admin_context()
     try:
         svc = service_obj.Service.update(ctx, self.engine_id)
         # if svc is None, means it's not created.
         if svc is None:
             service_obj.Service.create(ctx, self.engine_id, self.host,
                                        'kingbird-engine', self.topic)
     except Exception as ex:
         LOG.error('Service %(service_id)s update failed: %(error)s', {
             'service_id': self.engine_id,
             'error': ex
         })