stack lock acquire doesn't work with an admin context

Bug #1516712 reported by Thomas Herve
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve Baker

Bug Description

When the engine starts and it tries to recover stack in progress, you may see the following traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 457, in fire_timers
    timer()
  File "/usr/lib/python2.7/site-packages/eventlet/hubs/timer.py", line 58, in __call__
    cb(*args, **kw)
  File "/usr/lib/python2.7/site-packages/eventlet/greenthread.py", line 214, in main
    result = function(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 105, in wrapper
    return f(*args, **kwargs)
  File "/opt/stack/heat/heat/engine/service.py", line 1842, in reset_stack_status
    lock.acquire(retry=False)
  File "/opt/stack/heat/heat/engine/stack_lock.py", line 111, in acquire
    stack_name=stack.name, action=stack.action)
AttributeError: 'NoneType' object has no attribute 'name'

StackLock.acquire calls stack_object.Stack.get_by_id to retrieve the stack, but in reset_stack_status, it actually uses the admin context, so stack_get doesn't return anything. It should pass tenant_safe=False to work.

Thomas Herve (therve)
Changed in heat:
milestone: none → mitaka-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: New → In Progress
Changed in heat:
assignee: Thomas Herve (therve) → Steve Baker (steve-stevebaker)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/245943
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=9924d780e82d8419783177094d63c8333482a129
Submitter: Jenkins
Branch: master

commit 9924d780e82d8419783177094d63c8333482a129
Author: Thomas Herve <email address hidden>
Date: Mon Nov 16 20:45:25 2015 +0100

    Fix stack lock ActionInProgress in the admin case

    When the engine starts and tries to reset the status of stacks in
    progress, it tries to acquire the stack lock on them. The stack lock
    queries the database to retrieve the name of the stack, but does a
    tenant-scope query, thus fails when as we use the admin context during
    startup. This fixes it by passing tenant_safe=False.

    Change-Id: I4393fdb601eedb36d7288afd57fb5a1c96af7216
    Closes-Bug: #1516712

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/246642

tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (stable/liberty)

Reviewed: https://review.openstack.org/246642
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=532c8f448285185548850fedd49376af48697e85
Submitter: Jenkins
Branch: stable/liberty

commit 532c8f448285185548850fedd49376af48697e85
Author: Thomas Herve <email address hidden>
Date: Mon Nov 16 20:45:25 2015 +0100

    Fix stack lock ActionInProgress in the admin case

    When the engine starts and tries to reset the status of stacks in
    progress, it tries to acquire the stack lock on them. The stack lock
    queries the database to retrieve the name of the stack, but does a
    tenant-scope query, thus fails when as we use the admin context during
    startup. This fixes it by passing tenant_safe=False.

    Change-Id: I4393fdb601eedb36d7288afd57fb5a1c96af7216
    Closes-Bug: #1516712
    (cherry picked from commit 9924d780e82d8419783177094d63c8333482a129)

tags: added: in-stable-liberty
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/heat 6.0.0.0b1

This issue was fixed in the openstack/heat 6.0.0.0b1 development milestone.

Changed in heat:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/heat 5.0.1

This issue was fixed in the openstack/heat 5.0.1 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.