diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-12-11 07:18:35 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2013-01-04 13:42:22 +0000 |
| commit | f80e924737c0db8025aa71cad2f83f74f8ea742b (patch) | |
| tree | 574dd9ccc06409b756140a12d0f62f10f9bd1ae7 | |
| parent | b6843ad968ca03797d968625e8bec814caa42aa0 (diff) | |
| download | nova-f80e924737c0db8025aa71cad2f83f74f8ea742b.tar.gz nova-f80e924737c0db8025aa71cad2f83f74f8ea742b.tar.xz nova-f80e924737c0db8025aa71cad2f83f74f8ea742b.zip | |
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
| -rw-r--r-- | nova/config.py | 5 | ||||
| -rw-r--r-- | nova/openstack/common/rpc/__init__.py | 16 | ||||
| -rw-r--r-- | nova/openstack/common/rpc/amqp.py | 5 |
3 files changed, 11 insertions, 15 deletions
diff --git a/nova/config.py b/nova/config.py index 4f4fbe822..c1204892e 100644 --- a/nova/config.py +++ b/nova/config.py @@ -21,6 +21,7 @@ import os import socket from nova.openstack.common import cfg +from nova.openstack.common import rpc def _get_my_ip(): @@ -176,15 +177,13 @@ global_opts = [ cfg.StrOpt('volume_api_class', default='nova.volume.cinder.API', help='The full class name of the volume API class to use'), - cfg.StrOpt('control_exchange', - default='nova', - help='AMQP exchange to connect to if using RabbitMQ or Qpid'), ] cfg.CONF.register_opts(global_opts) def parse_args(argv, default_config_files=None): + rpc.set_defaults(control_exchange='nova') cfg.CONF(argv[1:], project='nova', default_config_files=default_config_files) 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 |
