[openstack-dev] guidance re: cfg module usage -- failure to recognize options in nova.conf

Mark McLoughlin markmc at redhat.com
Thu Apr 11 09:57:05 UTC 2013


Hi,

On Wed, 2013-04-10 at 16:49 -0700, Eric Hankins wrote:
> All,
> 
> Apologies for what is hopefully a simple issue...been staring at it for far
> too long and I'm not sure what I'm missing.
> 
> I've been fixing up the nova-dns module I found on github to manage inserts
> of new instance DNS info into PowerDNS.
> 
> It configures its kombu BrokerConnection with the following params block:
> 
>         self.params = dict(hostname=FLAGS.rabbit_host,
>                           port=FLAGS.rabbit_port,
>                           userid=FLAGS.rabbit_userid,
>                           password=FLAGS.rabbit_password,
>                           virtual_host=FLAGS.rabbit_virtual_host)
> 
> When I go to fire it up, it's claiming that rabbit_host isn't defined:
> 
> Traceback (most recent call last):
>   File "/usr/bin/nova-dns", line 55, in <module>
>     service.serve(dns.Service(), amqp.Service())
>   File "/usr/lib/pymodules/python2.7/nova_dns/amqp.py", line 50, in __init__
>     self.params = dict(hostname=FLAGS.rabbit_host,
>   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/cfg.py",
> line 1039, in __getattr__
>     return self._get(name)
>   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/cfg.py",
> line 1361, in _get
>     value = self._substitute(self._do_get(name, group))
>   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/cfg.py",
> line 1377, in _do_get
>     info = self._get_opt_info(name, group)
>   File "/usr/lib/python2.7/dist-packages/nova/openstack/common/cfg.py",
> line 1470, in _get_opt_info
>     raise NoSuchOptError(opt_name, group)
> nova.openstack.common.cfg.NoSuchOptError: no such option: rabbit_host
> 
> However, it clearly is, under my [DEFAULT] block in nova.conf:
> 
> # grep rabbit_host /etc/nova/nova.conf
> rabbit_host=localhost

There needs to be a register_opt() call somewhere which registers the
'rabbit_host' option

e.g. in impl_kombu:

    cfg.StrOpt('rabbit_host',
               default='localhost',
               help='The RabbitMQ broker address where a single node is used'),


cfg.CONF.register_opts(kombu_opts)

Maybe you just need to import the rpc module? Hmm, you actually probably
need to call e.g. rpc.create_connection() so that impl_kombu gets
imported

Cheers,
Mark.




More information about the OpenStack-dev mailing list