Fix get_async_step_return_state to account for servicing

Change-Id: I502be5613ffef7c2f51eafd0a10d5e9c5d5ec2a4
(cherry picked from commit c1ce255f010983b5f525bc38d2f3a0a7a34176b0)
This commit is contained in:
Dmitry Tantsur 2024-04-11 10:55:45 +02:00
parent df29eef628
commit 5f9ceb492d

@ -1451,13 +1451,24 @@ parse_instance_info_capabilities = (
def get_async_step_return_state(node):
"""Returns state based on operation (cleaning/deployment) being invoked
"""Returns state based on operation being invoked.
:param node: an ironic node object.
:returns: states.CLEANWAIT if cleaning operation in progress
or states.DEPLOYWAIT if deploy operation in progress.
:returns: states.CLEANWAIT if cleaning operation in progress,
or states.DEPLOYWAIT if deploy operation in progress,
or states.SERVICEWAIT if servicing in progress.
"""
return states.CLEANWAIT if node.clean_step else states.DEPLOYWAIT
# FIXME(dtantsur): this distinction is rather useless, create a new
# constant to use for all step types?
if node.clean_step:
return states.CLEANWAIT
elif node.service_step:
return states.SERVICEWAIT
else:
# TODO(dtantsur): ideally, check for node.deploy_step and raise
# something if this function is called without any step field set.
# Unfortunately, a lot of unit tests rely on exactly this.
return states.DEPLOYWAIT
def _check_agent_token_prior_to_agent_reboot(node):