def __init__(self, host, project, identification, mgr): super(ConductorAPI, self).__init__() self.topic = 'namos.conductor' self.project = project self.host = host self.server_topic = identification self.mgr = mgr # Setup the messaging tweaks ! here rpc._ALIASES.update( { '%s.openstack.common.rpc.impl_kombu' % project: 'rabbit', '%s.openstack.common.rpc.impl_qpid' % project: 'qpid', '%s.openstack.common.rpc.impl_zmq' % project: 'zmq', } ) # TODO(mrkanag) Ceilometer is causing an issue with this in place. oslo_messaging.set_transport_defaults('namos') self.client = rpc.get_rpc_client(version=self.RPC_API_VERSION, topic=self.topic) self.server = rpc.get_rpc_server(host=self.host, topic='namos.CONF.%s' % identification, endpoint=self, version=self.RPC_API_VERSION)
def __init__(self, url=None, backend=None, username=None, password=None, hosts=None, virt_host=None, exchange=None): super(AMQP, self).__init__() if exchange: oslo_msg.set_transport_defaults(control_exchange=exchange) if url: self.TRANSPORT = oslo_msg.get_transport(CONF, url=url) elif not backend and not hosts: raise ValueError("missing AMQP parameters") else: t_hosts = self._createTransportHosts(username, password, hosts) t_url = oslo_msg.TransportURL(CONF, transport=backend, virtual_host=virt_host, hosts=t_hosts, aliases=None) self.TRANSPORT = oslo_msg.get_transport(CONF, url=t_url)
def setup_transports(url, optional): global TRANSPORT, NOTIFICATIONS_TRANSPORT oslo_messaging.set_transport_defaults('heat') exmods = ['heat.common.exception'] TRANSPORT = get_specific_transport(url, optional, exmods) NOTIFICATIONS_TRANSPORT = get_specific_transport(url, optional, exmods, is_for_notifications=True)
def setup(url=None, optional=False): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER if url and url.startswith("fake://"): # NOTE(sileht): oslo_messaging fake driver uses time.sleep # for task switch, so we need to monkey_patch it eventlet.monkey_patch(time=True) if not TRANSPORT: oslo_messaging.set_transport_defaults('bilean') exmods = ['bilean.common.exception'] try: TRANSPORT = oslo_messaging.get_transport( cfg.CONF, url, allowed_remote_exmods=exmods) except oslo_messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: # NOTE(sileht): oslo_messaging is configured but unloadable # so reraise the exception raise if not NOTIFIER and TRANSPORT: serializer = RequestContextSerializer(JsonPayloadSerializer()) NOTIFIER = oslo_messaging.Notifier(TRANSPORT, serializer=serializer)
def _schedule(self, context, topic, request_spec, filter_properties): """Picks a host that is up at random.""" #elevated = context.elevated() #hosts = self.hosts_up(elevated, topic) #if not hosts: # msg = _("Is the appropriate service running?") # raise exception.NoValidHost(reason=msg) #host = self.scheduler_api.testSchedule({}, 'localhost', None) messaging.set_transport_defaults('hades') TRANSPORT = messaging.get_transport(CONF, url = 'rabbit://*****:*****@20.0.1.11:5672/', allowed_remote_exmods = [], aliases = {}) target = messaging.Target(topic = 'hades_scheduler_topic') version_cap = None serializer = None client = messaging.RPCClient(TRANSPORT, target, version_cap = version_cap, serializer = serializer) cctxt = client.prepare(server = 'pike') host = cctxt.call({}, 'testSchedule', host = 'pike', arg = '') return host
def setup(url=None, optional=False): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER if url and url.startswith("fake://"): # NOTE: oslo_messaging fake driver uses time.sleep # for task switch, so we need to monkey_patch it eventlet.monkey_patch(time=True) if not TRANSPORT: messaging.set_transport_defaults('senlin') exmods = ['senlin.common.exception'] try: TRANSPORT = messaging.get_transport(cfg.CONF, url, allowed_remote_exmods=exmods) except messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: # NOTE: oslo_messaging is configured but unloadable # so reraise the exception raise if not NOTIFIER and TRANSPORT: serializer = RequestContextSerializer(JsonPayloadSerializer()) NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer, topics=['versioned_notifications'])
def setup(service_name): """Initialise the oslo_messaging layer.""" messaging.set_transport_defaults('sahara') setup_notifications() if service_name != 'all-in-one': setup_service_messaging()
def prepare_service(argv=None): oslo_i18n.enable_lazy() log.set_defaults(_DEFAULT_LOG_LEVELS) log.register_options(CONF) if argv is None: argv = sys.argv CONF(argv[1:], project='glance-search') log.setup(cfg.CONF, 'glance-search') oslo_messaging.set_transport_defaults('glance')
def prepare_service(argv=None): oslo_i18n.enable_lazy() log.set_defaults(_DEFAULT_LOG_LEVELS) log.register_options(CONF) if argv is None: argv = sys.argv CONF(argv[1:], project='searchlight') log.setup(cfg.CONF, 'searchlight') oslo_messaging.set_transport_defaults('searchlight')
def setup_client(rpc_endpoint_info, topic, server): oslo_messaging.set_transport_defaults(rpc_endpoint_info.Exchange) transport = oslo_messaging.get_rpc_transport(cfg.CONF, url=rpc_endpoint_info.TransportEndpoint) target = oslo_messaging.Target(topic=topic, version=rpc_endpoint_info.Version, server=server, namespace=rpc_endpoint_info.Namespace) client = oslo_messaging.RPCClient(transport, target) return client
def main(manager='apmec.conductor.conductor_server.Conductor'): init(sys.argv[1:]) logging.setup(cfg.CONF, "apmec") oslo_messaging.set_transport_defaults(control_exchange='apmec') logging.setup(cfg.CONF, "apmec") cfg.CONF.log_opt_values(LOG, logging.DEBUG) server = apmec_service.Service.create(binary='apmec-conductor', topic=topics.TOPIC_CONDUCTOR, manager=manager) service.launch(cfg.CONF, server).wait()
def main(manager='tacker.conductor.conductor_server.Conductor'): init(sys.argv[1:]) objects.register_all() logging.setup(CONF, "tacker") oslo_messaging.set_transport_defaults(control_exchange='tacker') logging.setup(CONF, "tacker") CONF.log_opt_values(LOG, logging.DEBUG) server = tacker_service.Service.create(binary='tacker-conductor', topic=topics.TOPIC_CONDUCTOR, manager=manager) service.launch(CONF, server, restart_method='mutate').wait()
def get_rpc_client(topic, exchange, version, retry=None, timeout=60, **kwargs): """Return a configured olso.messaging RPCClient.""" oslo_messaging.set_transport_defaults(exchange) target = oslo_messaging.Target(version=version, topic=topic, **kwargs) serializer = RequestContextSerializer(JsonPayloadSerializer()) transport = get_transport(optional=True) return oslo_messaging.RPCClient(transport, target, serializer=serializer, retry=retry, version_cap=version, timeout=timeout)
def __init__(self): """Initialize the driver plugin RPC client.""" self.environment_prefix = 'Project' self.topic = '%s_%s' % (f5_const.TOPIC_PROCESS_ON_HOST_V2, self.environment_prefix) messaging.set_transport_defaults('neutron') self.transport = messaging.get_transport( CONF, url=CONF.f5_lbaasv2_driver.transport_url) self.target = messaging.Target(topic=self.topic) self.client = messaging.RPCClient(self.transport, self.target) self.context = context.get_admin_context().to_dict()
def init(args, **kwargs): product_name = "hyperswitch-agent" logging.register_options(cfg.CONF) cfg.CONF(args=args, project=product_name, version='%%(prog)s %s' % version.version_info.release_string(), **kwargs) oslo_messaging.set_transport_defaults( control_exchange=hs_constants.HYPERSWITCH) logging.setup(cfg.CONF, product_name)
def main(manager='tacker.conductor.conductor_server.Conductor'): init(sys.argv[1:]) objects.register_all() logging.setup(cfg.CONF, "tacker") oslo_messaging.set_transport_defaults(control_exchange='tacker') logging.setup(cfg.CONF, "tacker") cfg.CONF.log_opt_values(LOG, logging.DEBUG) server = tacker_service.Service.create( binary='tacker-conductor', topic=topics.TOPIC_CONDUCTOR, manager=manager) service.launch(cfg.CONF, server, restart_method='mutate').wait()
def prepare_service(argv=None): oslo_i18n.enable_lazy() log.set_defaults(_DEFAULT_LOG_LEVELS) log.register_options(CONF) gmr.TextGuruMeditation.setup_autorun(version) utils.register_plugin_opts() if argv is None: argv = sys.argv CONF(argv[1:], project='searchlight') log.setup(cfg.CONF, 'searchlight') oslo_messaging.set_transport_defaults('searchlight')
def setup(service_name): """Initialise the oslo_messaging layer.""" global MESSAGING_TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER if (service_name == 'all-in-one' and not cfg.CONF.oslo_messaging_notifications.enable): LOG.info(_LI("Notifications disabled")) return messaging.set_transport_defaults('sahara') setup_notifications() if service_name != 'all-in-one': setup_service_messaging()
def test_set_default_control_exchange(self): oslo_messaging.set_transport_defaults(control_exchange='foo') self.mox.StubOutWithMock(driver, 'DriverManager') invoke_kwds = mox.ContainsKeyValue('default_exchange', 'foo') driver.DriverManager(mox.IgnoreArg(), mox.IgnoreArg(), invoke_on_load=mox.IgnoreArg(), invoke_args=mox.IgnoreArg(), invoke_kwds=invoke_kwds).\ AndReturn(_FakeManager(_FakeDriver(self.conf))) self.mox.ReplayAll() oslo_messaging.get_transport(self.conf)
def __init__(self, app, conf): self.logger = get_logger(conf, log_route='ceilometer') self._app = app oslo_messaging.set_transport_defaults( conf.get('control_exchange', 'swift') ) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_notification_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topics=[conf.get('topic', 'notifications')] )
def start_server(): oslo_messaging.set_transport_defaults(transport_default) transport = oslo_messaging.get_transport(cfg.CONF) # cfg.CONF(["--config-file", "oslo.messaging.conf"]) target = oslo_messaging.Target(topic=topic_default, server='myserver') endpoints = [TestEndpoint(None)] server = oslo_messaging.get_rpc_server(transport, target, endpoints, executor='threading') server.start() server.wait()
def setup(): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER messaging.set_transport_defaults('sahara') TRANSPORT = messaging.get_transport(cfg.CONF, aliases=_ALIASES) if not cfg.CONF.enable_notifications: LOG.info(_LI("Notifications disabled")) return LOG.info(_LI("Notifications enabled")) serializer = ContextSerializer(JsonPayloadSerializer()) NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer)
def setup(): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER messaging.set_transport_defaults('sahara') TRANSPORT = messaging.get_transport(cfg.CONF, aliases=_ALIASES) if not cfg.CONF.oslo_messaging_notifications.enable: LOG.info(_LI("Notifications disabled")) return LOG.info(_LI("Notifications enabled")) serializer = ContextSerializer(JsonPayloadSerializer()) NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer)
def setup(): oslo_messaging.set_transport_defaults('ceilometer') # NOTE(sileht): When batch is not enabled, oslo.messaging read all messages # in the queue and can consume a lot of memory, that works for rpc because # you never have a lot of message, but sucks for notification. The # default is not changeable on oslo.messaging side. And we can't expose # this option to set set_transport_defaults because it a driver option. # 100 allow to prefetch a lot of messages but limit memory to 1G per # workers in worst case (~ 1M Nova notification) # And even driver options are located in private module, this is not going # to break soon. cfg.set_defaults( impl_rabbit.rabbit_opts, rabbit_qos_prefetch_count=100, )
def test_set_default_control_exchange(self): oslo_messaging.set_transport_defaults(control_exchange='foo') driver.DriverManager = mock.Mock() invoke_kwds = dict(default_exchange='foo', allowed_remote_exmods=[]) driver.DriverManager.return_value = \ _FakeManager(_FakeDriver(self.conf)) oslo_messaging.get_transport(self.conf) driver.DriverManager.assert_called_once_with(mock.ANY, mock.ANY, invoke_on_load=mock.ANY, invoke_args=mock.ANY, invoke_kwds=invoke_kwds)
def start_client(at_least_once): oslo_messaging.set_transport_defaults(transport_default) transport = oslo_messaging.get_transport(cfg.CONF) # in this way you can simulate the mandatory flag error # inside the function `call` # change: options = oslo_messaging.TransportOptions(at_least_once=True) # to: options = oslo_messaging.TransportOptions(at_least_once=False) # in this way you will see the different behaviour # replace 'my_not_existing_topic' value with to 'my_topic' to make it # working. target = oslo_messaging.Target(topic="my_not_existing_topic", version='2.0', namespace='test') # with at_least_once=False ( current default value) you will see the # timeout error. # with at_least_once=True ( so mandatory flag) you will see the excpetion raised. # that it is faster to raise :))! options = oslo_messaging.TransportOptions(at_least_once=at_least_once) client = oslo_messaging.RPCClient(transport, target, transport_options=options) for i in range(0, 1): time.sleep(0.1) try: r = client.call({}, 'foo', id_value=str(i), test_value="ciao", timeout=2) print("hello" + r + " - number: " + str(number)) except oslo_messaging.exceptions.MessageUndeliverable as e: ### Raised when at_least_once is True, and it is reaised immediately prRed( "MessageUndeliverable error, RabbitMQ Exception: %s, routing_key: %s message: %s exchange: %s: \n" % (e.exception, e.routing_key, e.message.body, e.exchange)) except oslo_messaging.exceptions.MessagingTimeout as et: ### Raised when at_least_once is False, you have to wait the timeout prRed("MessagingTimeout error: %s: \n" % (str(et)))
def __init__(self, app, conf): self._app = app self.ignore_projects = [ proj.strip() for proj in conf.get('ignore_projects', 'gnocchi').split(',')] oslo_messaging.set_transport_defaults(conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topic=conf.get('topic', 'notifications')) self.metadata_headers = [h.strip().replace('-', '_').lower() for h in conf.get( "metadata_headers", "").split(",") if h.strip()] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_' self.log_level = getattr(logging, conf.get('log_level', 'WARNING')) LOG.setLevel(self.log_level) # NOTE: If the background thread's send queue fills up, the event will # be discarded # # For backward compatibility we default to False and therefore wait for # sending to complete. This causes swift proxy to hang if the # destination is unavailable. self.nonblocking_notify = types.Boolean()(conf.get( 'nonblocking_notify', False)) # Initialize the sending queue and threads, but only once self.send_timeout = float(conf.get('send_timeout', 30.0)) if self.nonblocking_notify and Swift.event_queue is None: Swift.processLock.acquire() if Swift.event_queue is None: Swift.event_queue = SimpleQueue() self.done_sending = multiprocessing.Event() self.start_queue_process() Swift.processLock.release()
def __init__(self, app, conf): self._app = app self.ignore_projects = self._get_ignore_projects(conf) oslo_messaging.set_transport_defaults(conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_notification_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topics=[conf.get('topic', 'notifications')]) self.metadata_headers = [h.strip().replace('-', '_').lower() for h in conf.get( "metadata_headers", "").split(",") if h.strip()] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_' LOG.setLevel(getattr(logging, conf.get('log_level', 'WARNING'))) # NOTE: If the background thread's send queue fills up, the event will # be discarded # # For backward compatibility we default to False and therefore wait for # sending to complete. This causes swift proxy to hang if the # destination is unavailable. self.nonblocking_notify = strutils.bool_from_string( conf.get('nonblocking_notify', False)) # Initialize the sending queue and thread, but only once if self.nonblocking_notify and Swift.event_queue is None: Swift.threadLock.acquire() if Swift.event_queue is None: send_queue_size = int(conf.get('send_queue_size', 1000)) Swift.event_queue = queue.Queue(send_queue_size) self.start_sender_thread() Swift.threadLock.release()
def main(): CONF(sys.argv[1:]) oslo_messaging.set_transport_defaults('myexchange') transport = oslo_messaging.get_transport(CONF) target = oslo_messaging.Target(topic='myroutingkey', server='myserver', version='2.0', namespace='test') server = create_server(CONF, transport, target) # Reset RPC server before starting server.start() server.stop() server.wait() # Thread for RPC server server_thread = threading.Thread(target=server_process, args=(server,)) server_thread.daemon = True server_thread.start() start_wsgi_server()
def start_client(): oslo_messaging.set_transport_defaults(transport_default) transport = oslo_messaging.get_transport(cfg.CONF) # in this way you can simulate the mandatory flag error # inside the function `call` # change: options = oslo_messaging.TransportOptions(at_least_once=True) # to: options = oslo_messaging.TransportOptions(at_least_once=False) # in this way you will see the different behaviour # replace 'my_not_existing_topic' value with to 'my_topic' to make it # working. target = oslo_messaging.Target(topic="my_not_existing_topic", version='2.0', namespace='test') _thread.start_new_thread(call, ( transport, target, 1, ))
def _schedule(self, context, request_spec, filter_properties): """Picks a host that is up at random.""" messaging.set_transport_defaults('hades') TRANSPORT = messaging.get_transport(CONF, url = 'rabbit://*****:*****@20.0.1.11:5672/', allowed_remote_exmods = [], aliases = {}) target = messaging.Target(topic=CONF.hades_arbiter_topic) version_cap = None serializer = None client = messaging.RPCClient(TRANSPORT, target, version_cap = version_cap, serializer = serializer) cctxt = client.prepare(server = 'pike') host = cctxt.call({}, 'testArbiter', arg='') return host
def setup(url=None, optional=False): """Initialise the oslo_messaging layer.""" global TRANSPORT if url and url.startswith("fake://"): # NOTE: oslo_messaging fake driver uses time.sleep # for task switch, so we need to monkey_patch it eventlet.monkey_patch(time=True) if not TRANSPORT: oslo_messaging.set_transport_defaults('dcmanager') exmods = ['dcmanager.common.exception'] try: TRANSPORT = oslo_messaging.get_transport( cfg.CONF, url, allowed_remote_exmods=exmods) except oslo_messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: raise LOG.info(TRANSPORT)
def register_common_config_options(): global _COMMON_OPTIONS_ALREADY_REGISTERED if _COMMON_OPTIONS_ALREADY_REGISTERED: return # Register the configuration options common_config.register_core_common_config_opts() # Ensure that the control exchange is set correctly oslo_messaging.set_transport_defaults(control_exchange='neutron') ks_loading.register_auth_conf_options(cfg.CONF, common_config.NOVA_CONF_SECTION) ks_loading.register_session_conf_options(cfg.CONF, common_config.NOVA_CONF_SECTION) # Register the nova configuration options common_config.register_nova_opts() ks_loading.register_auth_conf_options(cfg.CONF, common_config.PLACEMENT_CONF_SECTION) ks_loading.register_session_conf_options( cfg.CONF, common_config.PLACEMENT_CONF_SECTION) # Register the placement configuration options common_config.register_placement_opts() logging.register_options(cfg.CONF) # Register the ironic configuration options ks_loading.register_auth_conf_options(cfg.CONF, common_config.IRONIC_CONF_SECTION) ks_loading.register_session_conf_options(cfg.CONF, common_config.IRONIC_CONF_SECTION) ks_loading.register_adapter_conf_options(cfg.CONF, common_config.IRONIC_CONF_SECTION) common_config.register_ironic_opts() _COMMON_OPTIONS_ALREADY_REGISTERED = True
def setup(url=None, optional=False): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER, SERIALIZER if not cfg.CONF.enable_notifications: LOG.info(_LI("Notifications disabled")) return LOG.info(_LI("Notifications enabled")) messaging.set_transport_defaults('sahara') SERIALIZER = ContextSerializer(JsonPayloadSerializer()) try: TRANSPORT = messaging.get_transport(cfg.CONF, url, aliases=_ALIASES) except messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: raise if TRANSPORT: NOTIFIER = messaging.Notifier(TRANSPORT, serializer=SERIALIZER)
def __init__(self, app, conf): self._app = app self.ignore_projects = [ proj.strip() for proj in conf.get('ignore_projects', 'gnocchi').split(',')] oslo_messaging.set_transport_defaults(conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topic=conf.get('topic', 'notifications')) self.metadata_headers = [h.strip().replace('-', '_').lower() for h in conf.get( "metadata_headers", "").split(",") if h.strip()] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_'
def main(): opts = [cfg.StrOpt('host')] CONF.register_opts(opts) CONF(sys.argv[1:]) # Creates global transport and target variables oslo_messaging.set_transport_defaults('myexchange') global transport transport = oslo_messaging.get_transport(CONF) target = oslo_messaging.Target(topic='myroutingkey', server=CONF.host, version='2.0', namespace='test') global du_target du_target = oslo_messaging.Target(topic='myroutingkey', server="myserver", version='2.0', namespace='test') # Creates RPC server server = create_server(CONF, transport, target) server.start() server.stop() server.wait() # Runs RPC server until KeyboardInterrupt try: server.reset() server.start() while True: time.sleep(1) except KeyboardInterrupt: server.stop() server.wait() print("Stopping server")
def __init__(self, app, conf): self._app = app self.ignore_projects = [ proj.strip() for proj in conf.get('ignore_projects', 'gnocchi').split(',') ] oslo_messaging.set_transport_defaults( conf.get('control_exchange', 'swift')) self._notifier = oslo_messaging.Notifier( oslo_messaging.get_transport(cfg.CONF, url=conf.get('url')), publisher_id='ceilometermiddleware', driver=conf.get('driver', 'messagingv2'), topic=conf.get('topic', 'notifications')) self.metadata_headers = [ h.strip().replace('-', '_').lower() for h in conf.get("metadata_headers", "").split(",") if h.strip() ] self.reseller_prefix = conf.get('reseller_prefix', 'AUTH_') if self.reseller_prefix and self.reseller_prefix[-1] != '_': self.reseller_prefix += '_'
def setup(url=None, optional=False): """Initialise the oslo_messaging layer.""" global TRANSPORT, NOTIFIER if url and url.startswith("fake://"): # NOTE: oslo_messaging fake driver uses time.sleep # for task switch, so we need to monkey_patch it eventlet.monkey_patch(time=True) if not TRANSPORT: oslo_messaging.set_transport_defaults('dcmanager') exmods = ['dcmanager.common.exception'] try: TRANSPORT = oslo_messaging.get_transport( cfg.CONF, url, allowed_remote_exmods=exmods, aliases=_ALIASES) except oslo_messaging.InvalidTransportURL as e: TRANSPORT = None if not optional or e.url: raise if not NOTIFIER and TRANSPORT: serializer = RequestContextSerializer(JsonPayloadSerializer()) NOTIFIER = oslo_messaging.Notifier(TRANSPORT, serializer=serializer)
cfg.CONF.register_opts(core_opts) cfg.CONF.register_cli_opts(core_cli_opts) cfg.CONF.register_opts([ cfg.StrOpt( 'pybasedir', default=os.path.abspath(os.path.join(os.path.dirname(__file__), '../')), help='Directory where the kosmos python module is installed' ), cfg.StrOpt('state-path', default='/var/lib/kosmos', help='Top-level directory for maintaining kosmos\'s state'), ]) # Ensure that the control exchange is set correctly messaging.set_transport_defaults(control_exchange='kosmos') _SQL_CONNECTION_DEFAULT = 'sqlite://' # Update the default QueuePool parameters. These can be tweaked by the # configuration variables - max_pool_size, max_overflow and pool_timeout db_options.set_defaults(cfg.CONF, connection=_SQL_CONNECTION_DEFAULT, sqlite_db='', max_pool_size=10, max_overflow=20, pool_timeout=10) logging.register_options(cfg.CONF) def init(args): cfg.CONF(args=args[1:], project='kosmos', version='%%prog %s' % version.version_info.release_string())
default='/var/lib/tacker', help=_("Where to store Tacker state files. " "This directory must be writable by the agent.")), ] logging.register_options(cfg.CONF) # Register the configuration options cfg.CONF.register_opts(core_opts) cfg.CONF.register_cli_opts(core_cli_opts) def config_opts(): return [(None, core_opts), (None, core_cli_opts)] # Ensure that the control exchange is set correctly oslo_messaging.set_transport_defaults(control_exchange='tacker') def set_db_defaults(): # Update the default QueuePool parameters. These can be tweaked by the # conf variables - max_pool_size, max_overflow and pool_timeout db_options.set_defaults( cfg.CONF, connection='sqlite://', sqlite_db='', max_pool_size=10, max_overflow=20, pool_timeout=10) set_db_defaults() def init(args, **kwargs):
'there are any events to send.')), ] core_cli_opts = [ cfg.StrOpt('state_path', default='/var/lib/nfvsvc', help=_("Where to store NFV Service state files. " "This directory must be writable by the agent.")), ] # Register the configuration options cfg.CONF.register_opts(core_opts) cfg.CONF.register_cli_opts(core_cli_opts) # Ensure that the control exchange is set correctly messaging.set_transport_defaults(control_exchange='vnfsvc') _SQL_CONNECTION_DEFAULT = 'sqlite://' # Update the default QueuePool parameters. These can be tweaked by the # configuration variables - max_pool_size, max_overflow and pool_timeout db_options.set_defaults(cfg.CONF, connection=_SQL_CONNECTION_DEFAULT, sqlite_db='', max_pool_size=10, max_overflow=20, pool_timeout=10) def init(args, **kwargs): cfg.CONF(args=args, project='vnfsvc', version='%%prog %s' % version.version_info.release_string(), **kwargs) # FIXME(ihrachys): if import is put in global, circular import
def setup(): oslo_messaging.set_transport_defaults('ceilometer')
def set_defaults(control_exchange): messaging.set_transport_defaults(control_exchange)
def _rpc_init(conf): global _rpc_TRANSPORT # NOTE(ft): set control_exchange parameter to use Nova cert topic messaging.set_transport_defaults('nova') _rpc_TRANSPORT = messaging.get_transport(conf)
def set_defaults(control_exchange='glance'): oslo_messaging.set_transport_defaults(control_exchange)
# Default SOA Values cfg.IntOpt('default-soa-refresh', default=3600), cfg.IntOpt('default-soa-retry', default=600), cfg.IntOpt('default-soa-expire', default=86400), cfg.IntOpt('default-soa-minimum', default=3600), ]) # Set some Oslo Log defaults log.set_defaults(default_log_levels=[ 'amqplib=WARN', 'amqp=WARN', 'boto=WARN', 'eventlet.wsgi.server=WARN', 'iso8601=WARN', 'kazoo.client=WARN', 'keystone=INFO', 'keystonemiddleware.auth_token=INFO', 'oslo_messaging=WARN', 'oslo_service.loopingcall=WARN', 'sqlalchemy=WARN', 'stevedore=WARN', 'suds=INFO', ]) # Set some Oslo RPC defaults messaging.set_transport_defaults('designate') # Set some Oslo Oslo Concurrency defaults lockutils.set_defaults(lock_path='$state_path')
def setup(): oslo_messaging.set_transport_defaults('aodh')
from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging from nova.i18n import _ from hyperagent import version messaging.set_transport_defaults(control_exchange='hyperagent') LOG = logging.getLogger(__name__) # import the configuration options cfg.CONF.import_opt('host', 'nova.netconf') cfg.CONF.import_opt('rootwrap_config', 'nova.utils') cfg.CONF.set_default('rootwrap_config', '/etc/hyperagent/rootwrap.conf') cfg.CONF.import_opt('ovs_vsctl_timeout', 'nova.network.linux_net') cfg.CONF.import_opt('network_device_mtu', 'nova.network.linux_net') AGENT_OPTS = [ cfg.StrOpt('root_helper', default='sudo', help=_('Root helper application.')), cfg.FloatOpt('report_interval', default=30, help=_('Seconds between nodes reporting state to server; ' 'should be less than agent_down_time, best if it ' 'is half or less than agent_down_time.')), ]
'when the network\'s preferred MTU is known.')), ] core_cli_opts = [ cfg.StrOpt('state_path', default='/var/lib/neutron', help=_("Where to store Neutron state files. " "This directory must be writable by the agent.")), ] # Register the configuration options cfg.CONF.register_opts(core_opts) cfg.CONF.register_cli_opts(core_cli_opts) # Ensure that the control exchange is set correctly oslo_messaging.set_transport_defaults(control_exchange='neutron') _SQL_CONNECTION_DEFAULT = 'sqlite://' # Update the default QueuePool parameters. These can be tweaked by the # configuration variables - max_pool_size, max_overflow and pool_timeout db_options.set_defaults(cfg.CONF, connection=_SQL_CONNECTION_DEFAULT, sqlite_db='', max_pool_size=10, max_overflow=20, pool_timeout=10) NOVA_CONF_SECTION = 'nova' nova_deprecated_opts = { 'cafile': [cfg.DeprecatedOpt('nova_ca_certificates_file', 'DEFAULT')], 'insecure': [cfg.DeprecatedOpt('nova_api_insecure', 'DEFAULT')], } ks_session.Session.register_conf_options(cfg.CONF, NOVA_CONF_SECTION,
paste_deploy, policy, resource, revoke, role, saml, security_compliance, shadow_users, signing, token, tokenless_auth, trust, ] oslo_messaging.set_transport_defaults(control_exchange='keystone') def set_default_for_default_log_levels(): """Set the default for the default_log_levels option for keystone. Keystone uses some packages that other OpenStack services don't use that do logging. This will set the default_log_levels default level for those packages. This function needs to be called before CONF(). """ extra_log_level_defaults = [ 'dogpile=INFO', 'routes=INFO',
cfg.CONF.register_opts(controller_worker_opts, group='controller_worker') cfg.CONF.register_opts(keepalived_vrrp_opts, group='keepalived_vrrp') cfg.CONF.register_opts(task_flow_opts, group='task_flow') cfg.CONF.register_opts(oslo_messaging_opts, group='oslo_messaging') cfg.CONF.register_opts(house_keeping_opts, group='house_keeping') cfg.CONF.register_opts(anchor_opts, group='anchor') cfg.CONF.register_cli_opts(core_cli_opts) cfg.CONF.register_opts(certificate_opts, group='certificates') cfg.CONF.register_cli_opts(healthmanager_opts, group='health_manager') cfg.CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token') cfg.CONF.register_opts(keystone_authtoken_v3_opts, group='keystone_authtoken_v3') # Ensure that the control exchange is set correctly messaging.set_transport_defaults(control_exchange='octavia') _SQL_CONNECTION_DEFAULT = 'sqlite://' # Update the default QueuePool parameters. These can be tweaked by the # configuration variables - max_pool_size, max_overflow and pool_timeout db_options.set_defaults(cfg.CONF, connection=_SQL_CONNECTION_DEFAULT, sqlite_db='', max_pool_size=10, max_overflow=20, pool_timeout=10) logging.register_options(cfg.CONF) def init(args, **kwargs): cfg.CONF(args=args, project='octavia', version='%%prog %s' % version.version_info.release_string(), **kwargs)