unit tests fail w/ RPC error importutils.import_module(_CONF.rpc_backend)

Bug #994775 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Dan Prince

Bug Description

I'm seeing failures when running a variety of the unit tests suites indivudually:

    _RPCIMPL = importutils.import_module(_CONF.rpc_backend)
AttributeError: 'NoneType' object has no attribute 'rpc_backend'

This happens right now when I run:

./run_tests.sh test_compute

Or :

./run_tests.sh api.openstack.compute.contrib.test_floating_ips

Essentially anything that makes use of fake rpc stuff during testing.

The fix seems to be to do this:

diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py
index 31e1902..1eadf9f 100644
--- a/nova/tests/__init__.py
+++ b/nova/tests/__init__.py
@@ -68,6 +68,7 @@ def setup():
     from nova.db import migration
     from nova.network import manager as network_manager
     from nova.tests import fake_flags
+ #rpc.register_opts(FLAGS)

     if FLAGS.sql_connection == "sqlite://":
         if migration.db_version() > migration.INIT_VERSION:

Dan Prince (dan-prince)
Changed in nova:
importance: Undecided → High
assignee: nobody → Dan Prince (dan-prince)
status: New → In Progress
Revision history for this message
Russell Bryant (russellb) wrote :

I've been running the tests a bunch, both individual tests and the whole test suite, and never saw a problem. :-(

I'm wondering why the line " FLAGS.register_opts(rpc.rpc_opts)" that comes just a few lines above the line you're adding didn't avoid this problem. The only difference is that this line would also call into whatever rpc_backend is configured and let it register anything it wants to, as well. Since fake_flags is loaded at this point, it's going to call into nova.rpc.impl_fake, which doesn't register anything....

Revision history for this message
Russell Bryant (russellb) wrote :

Btw, I know this register_opts() stuff is a pain. It was part of having to decouple nova.rpc from nova so it can move to openstack-common. If we can standardize having all of the projects use a global config object that lives in openstack.common.cfg then we can get rid of this mess.

Revision history for this message
Russell Bryant (russellb) wrote :

Oh nevermind, I see why this fixes it. Carry on. :-)

Revision history for this message
Dan Prince (dan-prince) wrote :

Thanks for the explanation Russel.

This was fixed in:

https://review.openstack.org/#/c/7134/

Changed in nova:
status: In Progress → Fix Committed
Devin Carlen (devcamcar)
Changed in nova:
milestone: none → folsom-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.