Beispiel #1
0
 def __init__(self, context=None):
     if context is None:
         context = ctxt.get_admin_context()
     self.context = context
     super(API, self).__init__(self._get_routing_key(),
                               RPC_API_VERSION,
                               serializer=ConductorSerializer())
Beispiel #2
0
def notify(context, message):
    """Sends a notification via RPC"""
    if not context:
        context = req_context.get_admin_context()
    priority = message.get('priority',
                           CONF.default_notification_level)
    priority = priority.lower()
    for topic in CONF.rpc_notifier2.topics:
        topic = '%s.%s' % (topic, priority)
        try:
            rpc.notify(context, topic, message, envelope=True)
        except Exception:
            LOG.exception(_("Could not send notification to %(topic)s. "
                            "Payload=%(message)s"), locals())
Beispiel #3
0
def setup_profiler(binary, host):
    if CONF.profiler.enabled:
        _notifier = notifier.create(
            "Messaging", messaging, context.get_admin_context().to_dict(),
            rpc.TRANSPORT, "trove", binary, host)
        notifier.set(_notifier)
        LOG.warn(_LW("The OpenStack Profiler is enabled. Using one of the "
                     "hmac_keys specified in the api-paste.ini file "
                     "(typically in /etc/trove), a trace can be made of all "
                     "requests. Only an admin user can retrieve the trace "
                     "information, however.\n"
                     "To disable the profiler, add the following to the "
                     "configuration file:\n"
                     "[profiler]\n"
                     "enabled=false"))
    else:
        web.disable()
Beispiel #4
0
def setup_profiler(binary, host):
    if CONF.profiler.enabled:
        _notifier = notifier.create("Messaging", messaging,
                                    context.get_admin_context().to_dict(),
                                    rpc.TRANSPORT, "trove", binary, host)
        notifier.set(_notifier)
        LOG.warn(
            _LW("The OpenStack Profiler is enabled. Using one of the "
                "hmac_keys specified in the api-paste.ini file "
                "(typically in /etc/trove), a trace can be made of all "
                "requests. Only an admin user can retrieve the trace "
                "information, however.\n"
                "To disable the profiler, add the following to the "
                "configuration file:\n"
                "[profiler]\n"
                "enabled=false"))
    else:
        web.disable()