示例#1
0
 def __init__(self):
     super(AlarmNotifierService, self).__init__()
     transport = messaging.get_transport()
     self.rpc_server = messaging.get_rpc_server(
         transport, cfg.CONF.alarm.notifier_rpc_topic, self)
     self.notifiers = extension.ExtensionManager(self.EXTENSIONS_NAMESPACE,
                                                 invoke_on_load=True)
示例#2
0
    def __init__(self):
        super(PartitionedAlarmService, self).__init__()
        transport = messaging.get_transport()
        self.rpc_server = messaging.get_rpc_server(
            transport, cfg.CONF.alarm.partition_rpc_topic, self)

        self.partition_coordinator = alarm_coordination.PartitionCoordinator()
示例#3
0
 def __init__(self):
     super(AlarmNotifierService, self).__init__()
     transport = messaging.get_transport()
     self.rpc_server = messaging.get_rpc_server(
         transport, cfg.CONF.alarm.notifier_rpc_topic, self)
     self.notifiers = extension.ExtensionManager(self.EXTENSIONS_NAMESPACE,
                                                 invoke_on_load=True)
    def test_published_no_mock(self):
        publisher = msg_publisher.RPCPublisher(
            netutils.urlsplit('rpc://'))

        endpoint = mock.MagicMock(['record_metering_data'])
        collector = messaging.get_rpc_server(
            self.transport, self.CONF.publisher_rpc.metering_topic, endpoint)
        endpoint.record_metering_data.side_effect = (lambda *args, **kwds:
                                                     collector.stop())

        collector.start()
        eventlet.sleep()
        publisher.publish_samples(context.RequestContext(),
                                  self.test_sample_data)
        collector.wait()

        class Matcher(object):
            @staticmethod
            def __eq__(data):
                for i, sample_item in enumerate(data):
                    if (sample_item['counter_name'] !=
                            self.test_sample_data[i].name):
                        return False
                return True

        endpoint.record_metering_data.assert_called_once_with(
            mock.ANY, data=Matcher())
示例#5
0
    def __init__(self):
        super(PartitionedAlarmService, self).__init__()
        transport = messaging.get_transport()
        self.rpc_server = messaging.get_rpc_server(
            transport, cfg.CONF.alarm.partition_rpc_topic, self)

        self.partition_coordinator = alarm_coordination.PartitionCoordinator()
示例#6
0
    def __init__(self):
        super(PartitionedAlarmService, self).__init__()
        self.rpc_server = messaging.get_rpc_server(
            cfg.CONF.alarm.partition_rpc_topic, self)

        self._load_evaluators()
        self.api_client = None
        self.partition_coordinator = coordination.PartitionCoordinator()
示例#7
0
    def __init__(self):
        super(PartitionedAlarmService, self).__init__()
        self.rpc_server = messaging.get_rpc_server(
            cfg.CONF.alarm.partition_rpc_topic, self)

        self._load_evaluators()
        self.api_client = None
        self.partition_coordinator = coordination.PartitionCoordinator()
示例#8
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        super(CollectorService, self).start()
        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        if self.rpc_enabled():
            self.rpc_server = messaging.get_rpc_server(cfg.CONF.publisher_rpc.metering_topic, self)
            self.rpc_server.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#9
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        super(CollectorService, self).start()
        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        if self.rpc_enabled():
            self.rpc_server = messaging.get_rpc_server(
                cfg.CONF.publisher_rpc.metering_topic, self)
            self.rpc_server.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#10
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        # ensure dispatcher is configured before starting other services
        dispatcher_managers = dispatcher.load_dispatcher_manager()
        (self.meter_manager, self.event_manager) = dispatcher_managers
        self.rpc_server = None
        self.sample_listener = None
        self.event_listener = None
        super(CollectorService, self).start()

        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        transport = messaging.get_transport(optional=True)
        if transport:
            if cfg.CONF.collector.enable_rpc:
                LOG.warning('RPC collector is deprecated in favour of queues. '
                            'Please switch to notifier publisher.')
                self.rpc_server = messaging.get_rpc_server(
                    transport, cfg.CONF.publisher_rpc.metering_topic, self)

            if list(self.meter_manager):
                sample_target = oslo_messaging.Target(
                    topic=cfg.CONF.publisher_notifier.metering_topic)
                self.sample_listener = messaging.get_notification_listener(
                    transport, [sample_target],
                    [SampleEndpoint(self.meter_manager)],
                    allow_requeue=(cfg.CONF.collector.
                                   requeue_sample_on_dispatcher_error))
                self.sample_listener.start()

            if cfg.CONF.notification.store_events and list(self.event_manager):
                event_target = oslo_messaging.Target(
                    topic=cfg.CONF.publisher_notifier.event_topic)
                self.event_listener = messaging.get_notification_listener(
                    transport, [event_target],
                    [EventEndpoint(self.event_manager)],
                    allow_requeue=(cfg.CONF.collector.
                                   requeue_event_on_dispatcher_error))
                self.event_listener.start()

            if cfg.CONF.collector.enable_rpc:
                self.rpc_server.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#11
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        # ensure dispatcher is configured before starting other services
        self.dispatcher_manager = dispatcher.load_dispatcher_manager()
        self.rpc_server = None
        self.sample_listener = None
        self.event_listener = None
        super(CollectorService, self).start()

        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        transport = messaging.get_transport(optional=True)
        if transport:
            if cfg.CONF.collector.enable_rpc:
                LOG.warning('RPC collector is deprecated in favour of queues. '
                            'Please switch to notifier publisher.')
                self.rpc_server = messaging.get_rpc_server(
                    transport, cfg.CONF.publisher_rpc.metering_topic, self)

            sample_target = oslo_messaging.Target(
                topic=cfg.CONF.publisher_notifier.metering_topic)
            self.sample_listener = messaging.get_notification_listener(
                transport, [sample_target],
                [SampleEndpoint(self.dispatcher_manager)],
                allow_requeue=(
                    cfg.CONF.collector.requeue_sample_on_dispatcher_error))

            if cfg.CONF.notification.store_events:
                event_target = oslo_messaging.Target(
                    topic=cfg.CONF.publisher_notifier.event_topic)
                self.event_listener = messaging.get_notification_listener(
                    transport, [event_target],
                    [EventEndpoint(self.dispatcher_manager)],
                    allow_requeue=(
                        cfg.CONF.collector.requeue_event_on_dispatcher_error))
                self.event_listener.start()

            if cfg.CONF.collector.enable_rpc:
                self.rpc_server.start()
            self.sample_listener.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#12
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        # ensure dispatcher is configured before starting other services
        self.dispatcher_manager = dispatcher.load_dispatcher_manager()
        self.rpc_server = None
        super(CollectorService, self).start()

        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        if messaging.TRANSPORT is not None:
            self.rpc_server = messaging.get_rpc_server(
                cfg.CONF.publisher_rpc.metering_topic, self)
            self.rpc_server.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#13
0
    def start(self):
        """Bind the UDP socket and handle incoming data."""
        # ensure dispatcher is configured before starting other services
        self.dispatcher_manager = dispatcher.load_dispatcher_manager()
        self.rpc_server = None
        super(CollectorService, self).start()

        if cfg.CONF.collector.udp_address:
            self.tg.add_thread(self.start_udp)

        transport = messaging.get_transport(optional=True)
        if transport:
            self.rpc_server = messaging.get_rpc_server(
                transport, cfg.CONF.publisher_rpc.metering_topic, self)
            self.rpc_server.start()

            if not cfg.CONF.collector.udp_address:
                # Add a dummy thread to have wait() working
                self.tg.add_timer(604800, lambda: None)
示例#14
0
 def __init__(self):
     self.rpc = messaging.get_rpc_server("alarm_notifier", self)
     self.notified = []
示例#15
0
 def __init__(self, transport):
     self.rpc = messaging.get_rpc_server(transport,
                                         "alarm_partition_coordination",
                                         self)
     self.notified = []
示例#16
0
 def __init__(self, transport):
     self.rpc = messaging.get_rpc_server(transport, "alarm_notifier", self)
     self.notified = []
示例#17
0
 def __init__(self, transport):
     self.rpc = messaging.get_rpc_server(transport, "alarm_notifier", self)
     self.notified = []
示例#18
0
 def __init__(self, transport):
     self.rpc = messaging.get_rpc_server(transport, "alarm_partition_coordination", self)
     self.notified = []
示例#19
0
 def __init__(self):
     super(AlarmNotifierService, self).__init__()
     transport = messaging.get_transport()
     self.rpc_server = messaging.get_rpc_server(
         transport, cfg.CONF.alarm.notifier_rpc_topic, self)
示例#20
0
 def __init__(self):
     self.rpc = messaging.get_rpc_server("alarm_notifier", self)
     self.notified = []
示例#21
0
 def __init__(self):
     super(AlarmNotifierService, self).__init__()
     transport = messaging.get_transport()
     self.rpc_server = messaging.get_rpc_server(
         transport, cfg.CONF.alarm.notifier_rpc_topic, self)