Fix prepare ramdisk for 'wait' states
Node can be in CLEANWAIT or DEPLOYWAIT during async step handling when it needs another reboot. Without this change node fails to boot back to IPA. This unifies all occurrences and create utility method for reuse. All occurrences are aligned to have the same set of states in case they are needed in future. Change-Id: I685c5827a70df4abb358635d89b86894671ac493
This commit is contained in:
parent
db808f6d33
commit
dd1cb46f2b
@ -374,14 +374,7 @@ class IloVirtualMediaBoot(base.BootInterface):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
node = task.node
|
node = task.node
|
||||||
# NOTE(TheJulia): If this method is being called by something
|
if not driver_utils.need_prepare_ramdisk(node):
|
||||||
# aside from deployment, clean and rescue, such as conductor takeover,
|
|
||||||
# we should treat this as a no-op and move on otherwise we would
|
|
||||||
# modify the state of the node due to virtual media operations.
|
|
||||||
if node.provision_state not in (states.DEPLOYING,
|
|
||||||
states.CLEANING,
|
|
||||||
states.RESCUING,
|
|
||||||
states.INSPECTING):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
prepare_node_for_deploy(task)
|
prepare_node_for_deploy(task)
|
||||||
@ -962,14 +955,7 @@ class IloUefiHttpsBoot(base.BootInterface):
|
|||||||
:raises: IloOperationError, if some operation on iLO failed.
|
:raises: IloOperationError, if some operation on iLO failed.
|
||||||
"""
|
"""
|
||||||
node = task.node
|
node = task.node
|
||||||
# NOTE(TheJulia): If this method is being called by something
|
if not driver_utils.need_prepare_ramdisk(node):
|
||||||
# aside from deployment, clean and rescue, such as conductor takeover,
|
|
||||||
# we should treat this as a no-op and move on otherwise we would
|
|
||||||
# modify the state of the node due to virtual media operations.
|
|
||||||
if node.provision_state not in (states.DEPLOYING,
|
|
||||||
states.CLEANING,
|
|
||||||
states.RESCUING,
|
|
||||||
states.INSPECTING):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
prepare_node_for_deploy(task)
|
prepare_node_for_deploy(task)
|
||||||
|
@ -971,13 +971,7 @@ class IRMCVirtualMediaBoot(base.BootInterface, IRMCVolumeBootMixIn):
|
|||||||
:raises: IRMCOperationError, if some operation on iRMC fails.
|
:raises: IRMCOperationError, if some operation on iRMC fails.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# NOTE(TheJulia): If this method is being called by something
|
if not driver_utils.need_prepare_ramdisk(task.node):
|
||||||
# aside from deployment, clean and rescue, such as conductor takeover,
|
|
||||||
# we should treat this as a no-op and move on otherwise we would
|
|
||||||
# modify the state of the node due to virtual media operations.
|
|
||||||
if task.node.provision_state not in (states.DEPLOYING,
|
|
||||||
states.CLEANING,
|
|
||||||
states.RESCUING):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# NOTE(tiendc): Before deploying, we need to backup BIOS config
|
# NOTE(tiendc): Before deploying, we need to backup BIOS config
|
||||||
|
@ -468,14 +468,7 @@ class RedfishVirtualMediaBoot(base.BootInterface):
|
|||||||
operation failed on the node.
|
operation failed on the node.
|
||||||
"""
|
"""
|
||||||
node = task.node
|
node = task.node
|
||||||
# NOTE(TheJulia): If this method is being called by something
|
if not driver_utils.need_prepare_ramdisk(node):
|
||||||
# aside from deployment, clean and rescue, such as conductor takeover,
|
|
||||||
# we should treat this as a no-op and move on otherwise we would
|
|
||||||
# modify the state of the node due to virtual media operations.
|
|
||||||
if node.provision_state not in (states.DEPLOYING,
|
|
||||||
states.CLEANING,
|
|
||||||
states.RESCUING,
|
|
||||||
states.INSPECTING):
|
|
||||||
return
|
return
|
||||||
|
|
||||||
d_info = _parse_driver_info(node)
|
d_info = _parse_driver_info(node)
|
||||||
|
@ -23,6 +23,7 @@ from oslo_utils import timeutils
|
|||||||
|
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
from ironic.common.i18n import _
|
from ironic.common.i18n import _
|
||||||
|
from ironic.common import states
|
||||||
from ironic.common import swift
|
from ironic.common import swift
|
||||||
from ironic.conductor import utils
|
from ironic.conductor import utils
|
||||||
from ironic.drivers import base
|
from ironic.drivers import base
|
||||||
@ -449,3 +450,23 @@ def get_agent_kernel_ramdisk(node, mode='deploy', deprecated_prefix=None):
|
|||||||
def get_agent_iso(node, mode='deploy', deprecated_prefix=None):
|
def get_agent_iso(node, mode='deploy', deprecated_prefix=None):
|
||||||
"""Get the agent ISO image."""
|
"""Get the agent ISO image."""
|
||||||
return get_field(node, f'{mode}_iso', deprecated_prefix)
|
return get_field(node, f'{mode}_iso', deprecated_prefix)
|
||||||
|
|
||||||
|
|
||||||
|
def need_prepare_ramdisk(node):
|
||||||
|
"""Check if node needs preparing ramdisk
|
||||||
|
|
||||||
|
:param node: Node to check for
|
||||||
|
:returns: True if need to prepare ramdisk, otherwise False
|
||||||
|
"""
|
||||||
|
# NOTE(TheJulia): If current node provisioning is something aside from
|
||||||
|
# deployment, clean, rescue or inspect such as conductor takeover,
|
||||||
|
# we should treat this as a no-op and move on otherwise we would
|
||||||
|
# modify the state of the node due to virtual media operations.
|
||||||
|
return node.provision_state in (states.DEPLOYING,
|
||||||
|
states.DEPLOYWAIT,
|
||||||
|
states.CLEANING,
|
||||||
|
states.CLEANWAIT,
|
||||||
|
states.RESCUING,
|
||||||
|
states.RESCUEWAIT,
|
||||||
|
states.INSPECTING,
|
||||||
|
states.INSPECTWAIT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user