neutron-lbaas tries to read neutron.conf from /usr

Bug #1433146 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Ihar Hrachyshka

Bug Description

neutron-lbaas is trying to read neutron.conf from /usr/lib/python2.7/dist-packages/etc/neutron.conf. Of course, in the context of building a Debian package, this fails miserably.

Also, I'm really not fan of neutron-lbaas and neutron being so interdependent. The way it is setup, neutron must build-depend on neutron-lbaas and neutron-lbaas must build-depend on neutron. It shouldn't be this way. One of the project should mock the other. Should I fill another bug report for this?

Tags: lbaas
Revision history for this message
Thomas Goirand (thomas-goirand) wrote :
Download full text (3.8 KiB)

I forgot some build logs... What's below is just an example, there's so many like this (all unit tests?).

FAIL: neutron_lbaas.tests.unit.test_agent_scheduler.LBaaSAgentSchedulerTestCase.test_schedule_loadbalancer_with_disabled_agent
neutron_lbaas.tests.unit.test_agent_scheduler.LBaaSAgentSchedulerTestCase.test_schedule_loadbalancer_with_disabled_agent
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
_StringException: Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "neutron_lbaas/tests/unit/test_agent_scheduler.py", line 115, in setUp
    self.plugin_str, service_plugins=service_plugins)
  File "neutron_lbaas/tests/base.py", line 51, in setUp
    plugin, service_plugins, ext_mgr)
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/test_db_plugin.py", line 88, in setUp
    super(NeutronDbPluginV2TestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/testlib_api.py", line 81, in setUp
    super(WebTestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/testlib_api.py", line 61, in setUp
    super(SqlTestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/base.py", line 106, in setUp
    self.setup_config()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/test_db_plugin.py", line 177, in setup_config
    super(NeutronDbPluginV2TestCase, self).setup_config(args=args)
  File "/usr/lib/python2.7/dist-packages/neutron/tests/base.py", line 170, in setup_config
    self.config_parse(args=args)
  File "/usr/lib/python2.7/dist-packages/neutron/tests/base.py", line 78, in config_parse
    config.init(args=args)
  File "/usr/lib/python2.7/dist-packages/neutron/common/config.py", line 176, in init
    **kwargs)
  File "/usr/lib/python2.7/dist-packages/oslo_config/cfg.py", line 1853, in __call__
    raise ConfigFilesNotFoundError(self._namespace._files_not_found)
ConfigFilesNotFoundError: Failed to find some config files: /usr/lib/python2.7/dist-packages/etc/neutron.conf

Traceback (most recent call last):
_StringException: Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "neutron_lbaas/tests/unit/test_agent_scheduler.py", line 115, in setUp
    self.plugin_str, service_plugins=service_plugins)
  File "neutron_lbaas/tests/base.py", line 51, in setUp
    plugin, service_plugins, ext_mgr)
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/test_db_plugin.py", line 88, in setUp
    super(NeutronDbPluginV2TestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/testlib_api.py", line 81, in setUp
    super(WebTestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/testlib_api.py", line 61, in setUp
    super(SqlTestCase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/base.py", line 106, in setUp
    self.setup_config()
  File "/usr/lib/python2.7/dist-packages/neutron/tests/unit/test_db_plugin.py", line 177, in setup_config
    s...

Read more...

tags: added: lbaas
Revision history for this message
Thomas Goirand (thomas-goirand) wrote :
Download full text (12.2 KiB)

One last comment: after fixing the use of oslo_log instead of the oslo-incubator log facility from Neutron (easy patch, I just fixed the imports...), then I had the issues on absolutely all unit tests. Then I just did a symlink:

ln -s /etc/neutron /usr/lib/python2.7/dist-packages/etc

then I had only 6 failures, which sound a lot more reasonable (at least, better than all unit tests failing over...).

FYI, here's the unit test failures, which I guess are kind of normal, because the Debian package is "fixing" the standard neutron.conf to use rootwrap rather than just sudo. So I don't think there's anything to actually fix here, but the expectation to have Neutron configured in a way or another. I'll drop the log just for fun, in this bug report. I don't really mind if I have to avoid these unit tests, but I do mind if the /etc folder thing isn't fixed (if someone has the solution, please let me know).

Note that I am available as zigo (or zigo_) on IRC to answer any question, and maybe help to reproduce.

======================================================================
FAIL: neutron_lbaas.tests.unit.services.loadbalancer.drivers.haproxy.test_synchronous_driver.TestHaproxyNSDriver.test_exists
neutron_lbaas.tests.unit.services.loadbalancer.drivers.haproxy.test_synchronous_driver.TestHaproxyNSDriver.test_exists
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
_StringException: Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "neutron_lbaas/tests/unit/services/loadbalancer/drivers/haproxy/test_synchronous_driver.py", line 577, in test_exists
    mock.call().netns.exists(lbns)
  File "/usr/lib/python2.7/dist-packages/mock.py", line 872, in assert_has_calls
    'Actual: %r' % (calls, self.mock_calls)
AssertionError: Calls not found.
Expected: [call('sudo'), call().netns.exists('nlbaas-sample_loadbalancer_id_1')]
Actual: [call('sudo neutron-rootwrap /etc/neutron/rootwrap.conf'),
 call().netns.exists('nlbaas-sample_loadbalancer_id_1')]

Traceback (most recent call last):
_StringException: Empty attachments:
  pythonlogging:''
  pythonlogging:'neutron.api.extensions'
  stderr
  stdout

Traceback (most recent call last):
  File "neutron_lbaas/tests/unit/services/loadbalancer/drivers/haproxy/test_synchronous_driver.py", line 577, in test_exists
    mock.call().netns.exists(lbns)
  File "/usr/lib/python2.7/dist-packages/mock.py", line 872, in assert_has_calls
    'Actual: %r' % (calls, self.mock_calls)
AssertionError: Calls not found.
Expected: [call('sudo'), call().netns.exists('nlbaas-sample_loadbalancer_id_1')]
Actual: [call('sudo neutron-rootwrap /etc/neutron/rootwrap.conf'),
 call().netns.exists('nlbaas-sample_loadbalancer_id_1')]

======================================================================
FAIL: neutron_lbaas.tests.unit.services.loadbalancer.drivers.haproxy.test_synchronous_driver.TestHaproxyNSDriver.test_plug
neutron_lbaas.tests.unit.services.loadbalancer.drivers.haproxy.test_synchronous_driver.TestHaproxyNSDriver.test_plug
-------------------------------------------...

Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

I guess that is triggered by https://review.openstack.org/#/c/159862/ that was recently merged.

Changed in neutron:
assignee: nobody → Ihar Hrachyshka (ihar-hrachyshka)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/165237

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron-lbaas (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/165417

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron-fwaas (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/165419

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron-vpnaas (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/165420

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/165421

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron-vpnaas (master)

Change abandoned by Ihar Hrachyshka (<email address hidden>) on branch: master
Review: https://review.openstack.org/165420
Reason: wrong change-id

Changed in neutron:
milestone: none → kilo-rc1
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron-lbaas (master)

Reviewed: https://review.openstack.org/165417
Committed: https://git.openstack.org/cgit/openstack/neutron-lbaas/commit/?id=14d4773e6361eea4d8efd9d59d716e37a8b16d8c
Submitter: Jenkins
Branch: master

commit 14d4773e6361eea4d8efd9d59d716e37a8b16d8c
Author: Ihar Hrachyshka <email address hidden>
Date: Wed Mar 18 14:51:00 2015 +0100

    tests: stop overwriting neutron BaseTestCase configuration files

    It's ok to expect configuration files that are passed by neutron's
    BaseTestCase, since they are located in the python package itself (under
    site-packages).

    Related-Bug: #1433146
    Change-Id: If1f5ebd981cf06558d5102524211799676068889

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron-fwaas (master)

Reviewed: https://review.openstack.org/165419
Committed: https://git.openstack.org/cgit/openstack/neutron-fwaas/commit/?id=832296a00f33cab645f3fd220b0ceae0dea0d525
Submitter: Jenkins
Branch: master

commit 832296a00f33cab645f3fd220b0ceae0dea0d525
Author: Ihar Hrachyshka <email address hidden>
Date: Tue Mar 17 23:58:18 2015 +0100

    tests: stop overwriting neutron BaseTestCase configuration files

    It's ok to expect configuration files that are passed by neutron's
    BaseTestCase, since they are located in the python package itself (under
    site-packages).

    Related-Bug: #1433146
    Change-Id: If1f5ebd981cf06558d5102524211799676068889

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron-vpnaas (master)

Reviewed: https://review.openstack.org/165421
Committed: https://git.openstack.org/cgit/openstack/neutron-vpnaas/commit/?id=fbc52701e77ccedc8b23cf9e60f5273db495fcf1
Submitter: Jenkins
Branch: master

commit fbc52701e77ccedc8b23cf9e60f5273db495fcf1
Author: Ihar Hrachyshka <email address hidden>
Date: Tue Mar 17 23:56:50 2015 +0100

    tests: stop overwriting neutron BaseTestCase configuration files

    It's ok to expect configuration files that are passed by neutron's
    BaseTestCase, since they are located in the python package itself (under
    site-packages).

    Related-Bug: #1433146
    Change-Id: If1f5ebd981cf06558d5102524211799676068889

Kyle Mestery (mestery)
Changed in neutron:
importance: Undecided → Low
Revision history for this message
Kyle Mestery (mestery) wrote :

Moving to Liberty-1.

Changed in neutron:
milestone: kilo-rc1 → liberty-1
Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

Kyle, I don't think it's a good idea to postpone this fix after Kilo. This is a real issue which is affecting absolutely all distributions. I don't think it's a good idea also to set the importance to "Low". (unless you only care about the gate, and don't care about downstream distributions)

Revision history for this message
Kyle Mestery (mestery) wrote :

Thomas and Ihar, apologies, I missed the patch, I thought this review was stalled. Moving back into Kilo-RC1 now. Thanks for pinging me on this!

Changed in neutron:
milestone: liberty-1 → kilo-rc1
importance: Low → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.openstack.org/165237
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3b66a9ff77a0c77075a1320d832f97de7aeab22a
Submitter: Jenkins
Branch: master

commit 3b66a9ff77a0c77075a1320d832f97de7aeab22a
Author: Ihar Hrachyshka <email address hidden>
Date: Wed Mar 18 14:21:57 2015 +0100

    tests: don't rely on configuration files outside tests directory

    etc/... may be non existent in some build environments. It's also pip
    does not install those files under site-packages neutron module, so
    paths relative to python files don't work.

    So instead of using relative paths to etc/... contents, maintain our own
    version of configuration files. It means we need to maintain tests only
    policy.json file too, in addition to neutron.conf.test and
    api-paste.ini.test.

    Ideally, we would make etc/policy.json copied under site-packages in
    addition to /etc/neutron/. In that way, we would not maintain a copy of
    policy.json file in two places.

    Though it seems that setuputils does not have a good way to install
    files under site-packages that would consider all the differences
    between python environments (specifically, different prefixes used in
    different systems).

    Note: it's not *absolutely* needed to update the test policy.json file
    on each next policy update, though it will be needed in cases when we
    want to test policy changes in unit tests. So adding a check to make
    sure files are identical.

    This partially reverts commit 1404f33b50452d4c0e0ef8c748011ce80303c2fd.

    Conflicts:
     neutron/policy.py

    Related-Bug: #1433146
    Change-Id: If1f5ebd981cf06558d5102524211799676068889

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-rc1 → 2015.1.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (neutron-pecan)

Related fix proposed to branch: neutron-pecan
Review: https://review.openstack.org/185072

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.