Fix broken validations on stack update

Patch I3be30ed8bb61d8ed514991a2f55c5c4e36c56411 fixed a confusing
message on initial deploy (bug #1703942) but broke stack update for
cases when there are no extra free nodes available (even though they
are not needed).

This patch reverts the earlier one and fixes the confusing message in
an alternative way -- we first validate available node count (a
validation for this already exists), and only if it succeeds we
proceed to validate the availability of nodes matching particular
flavors.

Change-Id: I91ddc03e5ac22494f5276f08f87011074483d5c6
Closes-Bug: #1745997
Related-Bug: #1703942
This commit is contained in:
Jiri Stransky 2018-02-23 13:35:21 +01:00
parent 21eb3f6aeb
commit 8ceb4e2b78
2 changed files with 19 additions and 25 deletions

View File

@ -332,15 +332,6 @@ class VerifyProfilesAction(base.TripleOAction):
bm_nodes = {node['uuid']: node for node in self.nodes
if node['provision_state'] in ('available', 'active')}
if not bm_nodes:
message = ('Error: There are no nodes in an available '
'or active state and with maintenance mode off.')
return_value = {
'errors': [message],
'warnings': [],
}
return actions.Result(error=return_value)
free_node_caps = {uu: self._node_get_capabilities(node)
for uu, node in bm_nodes.items()}

View File

@ -716,22 +716,6 @@ workflows:
errors: <% $.errors + task().result.get('errors', []) %>
warnings: <% $.warnings + task().result.get('warnings', []) %>
status: FAILED
on-success: verify_profiles
on-error: verify_profiles
verify_profiles:
workflow: verify_profiles
input:
flavors: <% $.flavors %>
run_validations: <% $.run_validations %>
queue_name: <% $.queue_name %>
publish:
errors: <% $.errors + task().result.get('errors', []) %>
warnings: <% $.warnings + task().result.get('warnings', []) %>
publish-on-error:
errors: <% $.errors + task().result.get('errors', []) %>
warnings: <% $.warnings + task().result.get('warnings', []) %>
status: FAILED
on-success: check_default_nodes_count
on-error: check_default_nodes_count
@ -754,6 +738,25 @@ workflows:
warnings: <% $.warnings + task().result.get('warnings', []) %>
statistics: <% task().result.get('statistics') %>
status: FAILED
on-success: verify_profiles
# Do not confuse user with info about profiles if the nodes
# count is off in the first place. Skip directly to
# send_message. (bug 1703942)
on-error: send_message
verify_profiles:
workflow: verify_profiles
input:
flavors: <% $.flavors %>
run_validations: <% $.run_validations %>
queue_name: <% $.queue_name %>
publish:
errors: <% $.errors + task().result.get('errors', []) %>
warnings: <% $.warnings + task().result.get('warnings', []) %>
publish-on-error:
errors: <% $.errors + task().result.get('errors', []) %>
warnings: <% $.warnings + task().result.get('warnings', []) %>
status: FAILED
on-success: send_message
on-error: send_message