Comment 5 for bug 1727127

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

Reviewed: https://review.openstack.org/535965
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=0519cd94fc3f95778e75f6fd917defa77f7d5afe
Submitter: Zuul
Branch: stable/pike

commit 0519cd94fc3f95778e75f6fd917defa77f7d5afe
Author: Zane Bitter <email address hidden>
Date: Mon Oct 30 17:07:12 2017 -0400

    Protect prepare_update_replace() with resource lock

    When we consolidated resource locking with resource state transitions in
    a7376f7494b310e9367ebe5dcb43b432a4053023, prepare_update_replace() moved
    outside of the locked section, so that other update operations could
    potentially conflict with it. This change ensures that we call it while the
    lock is still held (if we have transitioned the resource to
    UPDATE_IN_PROGRESS, and thus acquired the lock), or that we acquire the
    lock before calling it (if UpdateReplace is raised before attempting to
    update the resource).

    To avoid unnecessary locking and unlocking, we only take the lock if the
    Resource plugin has overridden the default handler method (either
    restore_prev_rsrc() or prepare_for_replace()), since the defaults do
    nothing.

     Conflicts:
     heat/engine/resource.py

    This differs from the patch on master because
    0e1b4908e55d6b1f11ec8cd190d719244194365c is not present in stable/pike,
    so there are different paths for the cases where there are or are not
    restricted actions in play.

    Change-Id: Ie32836ed643e440143bde8b83aeb4d6159acd034
    Closes-Bug: #1727127
    (cherry picked from commit b0e18270b4af43452d6c2e229aa76db7ff120980)