summaryrefslogtreecommitdiff
path: root/ironic/api/controllers
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@redhat.com>2015-07-22 13:55:24 +0200
committerDmitry Tantsur <dtantsur@redhat.com>2015-07-28 11:50:13 +0200
commit0f9c5d67c1dfebf9488c2eee3522e6fdbc1167fb (patch)
tree22d25554ad697a26ded236624b1f8e680f7d62a8 /ironic/api/controllers
parent6f0011786b74878b7f8ef4be295cfaf6b6224dcf (diff)
downloadironic-0f9c5d67c1dfebf9488c2eee3522e6fdbc1167fb.tar.gz
Don't prevent updates if power transition is in progress
Current behaviour results in 409 errors for innocent operations while e.g. slow (I've seen up to 1.5 minutes) power operation is on. This, for example, happens when Inspector is in use: the last action it does is to power off the node. If it takes time, many operations won't be possible on a node right after power action was requested. The problem with this particular operation is that it fails with 409 without any retries on a server side. This patch allows update request to reach conductor and to be retried inside the task_manager. Closes-Bug: #1478867 Change-Id: I43ea1b05b5021a658f47a6006ee9bb86018b3833
Diffstat (limited to 'ironic/api/controllers')
-rw-r--r--ironic/api/controllers/v1/node.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py
index 2b095b8fd..ad7b95fc2 100644
--- a/ironic/api/controllers/v1/node.py
+++ b/ironic/api/controllers/v1/node.py
@@ -1050,9 +1050,8 @@ class NodesController(rest.RestController):
LOG.debug('Removing instance uuid %(instance)s from node %(node)s',
{'instance': rpc_node.instance_uuid,
'node': rpc_node.uuid})
- elif ((rpc_node.target_power_state or rpc_node.target_provision_state)
- and rpc_node.provision_state not in
- ir_states.UPDATE_ALLOWED_STATES):
+ elif (rpc_node.target_provision_state and rpc_node.provision_state
+ not in ir_states.UPDATE_ALLOWED_STATES):
msg = _("Node %s can not be updated while a state transition "
"is in progress.")
raise wsme.exc.ClientSideError(msg % node_ident, status_code=409)