From f80e924737c0db8025aa71cad2f83f74f8ea742b Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Tue, 11 Dec 2012 07:18:35 +0000 Subject: Clean up setting of control_exchange default The RPC code from Oslo now registers the control_exchange option but provides us with an API for changing the default. blueprint: scope-config-opts Change-Id: Ie7950daaddb53f38eb72d2a113e1f26252dd6903 --- nova/openstack/common/rpc/__init__.py | 16 ++++++++-------- nova/openstack/common/rpc/amqp.py | 5 +---- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'nova/openstack') diff --git a/nova/openstack/common/rpc/__init__.py b/nova/openstack/common/rpc/__init__.py index a223e8fde..cfdac03bd 100644 --- a/nova/openstack/common/rpc/__init__.py +++ b/nova/openstack/common/rpc/__init__.py @@ -57,19 +57,19 @@ rpc_opts = [ cfg.BoolOpt('fake_rabbit', default=False, help='If passed, use a fake RabbitMQ provider'), - # - # The following options are not registered here, but are expected to be - # present. The project using this library must register these options with - # the configuration so that project-specific defaults may be defined. - # - #cfg.StrOpt('control_exchange', - # default='nova', - # help='AMQP exchange to connect to if using RabbitMQ or Qpid'), + cfg.StrOpt('control_exchange', + default='openstack', + help='AMQP exchange to connect to if using RabbitMQ or Qpid'), ] cfg.CONF.register_opts(rpc_opts) +def set_defaults(control_exchange): + cfg.set_defaults(rpc_opts, + control_exchange=control_exchange) + + def create_connection(new=True): """Create a connection to the message bus used for rpc. diff --git a/nova/openstack/common/rpc/amqp.py b/nova/openstack/common/rpc/amqp.py index a5a79cc30..6464914db 100644 --- a/nova/openstack/common/rpc/amqp.py +++ b/nova/openstack/common/rpc/amqp.py @@ -428,7 +428,4 @@ def cleanup(connection_pool): def get_control_exchange(conf): - try: - return conf.control_exchange - except cfg.NoSuchOptError: - return 'openstack' + return conf.control_exchange -- cgit