diff options
author | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2013-09-13 15:47:36 +0100 |
---|---|---|
committer | Lucas Alvares Gomes <lucasagomes@gmail.com> | 2013-09-17 19:42:38 +0100 |
commit | 864a25077ddcdb24fcb8d959ce74ce8e4a3a25f0 (patch) | |
tree | c33001717ec86ee5df251e864ab50f4f047a3698 /ironic/api/controllers/v1/node.py | |
parent | d5d42ad6558bb14d53d53a212efa1fadc79d6921 (diff) | |
download | ironic-864a25077ddcdb24fcb8d959ce74ce8e4a3a25f0.tar.gz |
Prevent updates while state change is in progress
This patch will prevent clients to update a node while its transitioning
from one state to another.
Change-Id: I3395916b5f9be3f6a5b6d7e6d92dd9353217d4d0
Diffstat (limited to 'ironic/api/controllers/v1/node.py')
-rw-r--r-- | ironic/api/controllers/v1/node.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py index 4031e6d28..bfa41124e 100644 --- a/ironic/api/controllers/v1/node.py +++ b/ironic/api/controllers/v1/node.py @@ -352,6 +352,15 @@ class NodesController(rest.RestController): "here; You must use the " "nodes/%s/state interface.") % uuid) + + # Prevent node from being updated when there's a state + # change in progress + if any(node.get(tgt) for tgt in ["target_power_state", + "target_provision_state"]): + raise wsme.exc.ClientSideError(_("Can not update node %s because " + "a state change is already in " + "progress.") % uuid) + try: final_patch = jsonpatch.apply_patch(node_dict, patch_obj) except jsonpatch.JsonPatchException as e: |