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)
Reviewed: https:/ /review. openstack. org/535965 /git.openstack. org/cgit/ openstack/ heat/commit/ ?id=0519cd94fc3 f95778e75f6fd91 7defa77f7d5afe
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 0519cd94fc3f957 78e75f6fd917def a77f7d5afe
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 310e9367ebe5dcb 43b432a4053023, prepare_ update_ replace( ) moved IN_PROGRESS, and thus acquired the lock), or that we acquire the
a7376f7494b
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_
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 prev_rsrc( ) or prepare_ for_replace( )), since the defaults do
Resource plugin has overridden the default handler method (either
restore_
nothing.
Conflicts: engine/ resource. py
heat/
This differs from the patch on master because d6b1f11ec8cd190 d719244194365c is not present in stable/pike,
0e1b4908e55
so there are different paths for the cases where there are or are not
restricted actions in play.
Change-Id: Ie32836ed643e44 0143bde8b83aeb4 d6159acd034 52d6c2e229aa76d b7ff120980)
Closes-Bug: #1727127
(cherry picked from commit b0e18270b4af434