nova-manage cell_v2 discover_hosts is broken

Bug #1650694 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
melanie witt
Newton
Fix Committed
Medium
Matt Riedemann

Bug Description

This is from an ocata devstack created 2 days ago:

(venv) stack@filters:/opt/stack/nova$ nova-manage cell_v2 discover_hosts 2016-12-17 00:57:07.652 DEBUG oslo_policy.policy [req-ed0bd6be-c6d8-4e25-895e-33e8fa50692f None None] The policy file policy.json could not be found. from (pid=29365) load_rules /opt/stack/nova/.tox/venv/local/lib/python2.7/site-packages/oslo_policy/policy.py:520
error: 'module' object has no attribute 'session'
(venv) stack@filters:/opt/stack/nova$

Revision history for this message
Matt Riedemann (mriedem) wrote :

I added some traceback to nova-manage when it fails, so the error is this:

(venv) stack@filters:/opt/stack/nova$ nova-manage cell_v2 discover_hosts
2016-12-17 01:00:42.678 DEBUG oslo_policy.policy [req-3451c236-fd9d-4ab6-aa58-5b918a3b0fb0 None None] The policy file policy.json could not be found. from (pid=29801) load_rules /opt/stack/nova/.tox/venv/local/lib/python2.7/site-packages/oslo_policy/policy.py:520
error:
Traceback (most recent call last):
  File "/opt/stack/nova/nova/cmd/manage.py", line 1584, in main
    ret = fn(*fn_args, **fn_kwargs)
  File "/opt/stack/nova/nova/cmd/manage.py", line 1519, in discover_hosts
    cell_mappings = objects.CellMappingList.get_all(context)
  File "/opt/stack/nova/.tox/venv/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 184, in wrapper
    result = fn(cls, context, *args, **kwargs)
  File "/opt/stack/nova/nova/objects/cell_mapping.py", line 127, in get_all
    db_mappings = cls._get_all_from_db(context)
  File "/opt/stack/nova/.tox/venv/local/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 894, in wrapper
    return fn(*args, **kwargs)
  File "/opt/stack/nova/nova/objects/cell_mapping.py", line 123, in _get_all_from_db
    return context.session.query(api_models.CellMapping).all()
AttributeError: 'module' object has no attribute 'session'

Changed in nova:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Matt Riedemann (mriedem) wrote :

I'm also seeing this outside a venv too.

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

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

melanie witt (melwitt)
Changed in nova:
assignee: nobody → melanie witt (melwitt)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/412035

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/412090

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

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

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

Reviewed: https://review.openstack.org/412024
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=928f046d24698f17de7a7433ad69986b3c223c8b
Submitter: Jenkins
Branch: master

commit 928f046d24698f17de7a7433ad69986b3c223c8b
Author: Matt Riedemann <email address hidden>
Date: Fri Dec 16 20:27:27 2016 -0500

    Make nova-manage emit a traceback when things blow up

    If we hit an unhandled error in nova-manage we don't
    get a traceback currently which makes debugging the actual
    failure hard. This change emits a traceback in main() when
    we get an unhandled exception up from one of the subcommands.

    Change-Id: Id8b8ad3c97c6834abc4290319cd6f2cd5aafa479
    Related-Bug: #1650694

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

Reviewed: https://review.openstack.org/412096
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f6b947a4fd16f11c8d150ea7331a2cde0bf7b527
Submitter: Jenkins
Branch: master

commit f6b947a4fd16f11c8d150ea7331a2cde0bf7b527
Author: Matt Riedemann <email address hidden>
Date: Sat Dec 17 10:15:14 2016 -0500

    nova-manage: squash oslo_policy debug logging

    I don't know when it started but you can see from a modern
    usage of nova-manage that oslo_policy debug logging is being
    emitted. We don't need that debug information in the console
    for nova-manage, so this patch hides it just like we do for
    oslo_db.

    Change-Id: If1a8e8d473846f2626f5e01210f00ad06916a383
    Related-Bug: #1650694

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/412035
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=93a9aaa1cfef8cb2b662790bdae3971368dba808
Submitter: Jenkins
Branch: master

commit 93a9aaa1cfef8cb2b662790bdae3971368dba808
Author: melanie witt <email address hidden>
Date: Sat Dec 17 03:13:01 2016 +0000

    Fix nova-manage cell_v2 discover_hosts RequestContext

    In the nova-manage cell_v2 discover_hosts command, the nova.context
    module is erroneously being passed to a database API function instead
    of a RequestContext object, causing the error on the command line:

      error: 'module' object has no attribute 'session'

    This corrects the argument and adds a test assertion for the
    RequestContext.

    Closes-Bug: #1650694

    Change-Id: I7b5468218e79ffc77adf15d2f00c063095d62af3

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

Reviewed: https://review.openstack.org/412047
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=446d9fed5f73a391324c2cfe645dd245e4985b04
Submitter: Jenkins
Branch: master

commit 446d9fed5f73a391324c2cfe645dd245e4985b04
Author: melanie witt <email address hidden>
Date: Sat Dec 17 06:00:43 2016 +0000

    Make nova-manage cell_v2 discover_hosts tests use DBs

    This refactors the discover_hosts tests to work with database fixtures
    to more realistically test the commands. Recently, a bug was masked
    because of mocking of the database APIs.

    Related-Bug: #1650694

    Change-Id: I6cb45beacce46c6f39861e7ca86be3bd09047b67

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/412090
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=730530b08e577adeaf112e60c5c58d507ad4bb8b
Submitter: Jenkins
Branch: stable/newton

commit 730530b08e577adeaf112e60c5c58d507ad4bb8b
Author: melanie witt <email address hidden>
Date: Sat Dec 17 03:13:01 2016 +0000

    Fix nova-manage cell_v2 discover_hosts RequestContext

    In the nova-manage cell_v2 discover_hosts command, the nova.context
    module is erroneously being passed to a database API function instead
    of a RequestContext object, causing the error on the command line:

      error: 'module' object has no attribute 'session'

    This corrects the argument and adds a test assertion for the
    RequestContext.

    Conflicts:
            nova/tests/unit/test_nova_manage.py

    NOTE(mriedem): The conflict is due to the validate transport
    tests from ocata not being in test_nova_manage in newton.

    Closes-Bug: #1650694

    Change-Id: I7b5468218e79ffc77adf15d2f00c063095d62af3
    (cherry picked from commit 93a9aaa1cfef8cb2b662790bdae3971368dba808)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b3

This issue was fixed in the openstack/nova 15.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.4

This issue was fixed in the openstack/nova 14.0.4 release.

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.