Allow hardware managers to override clean step priority
If two hardware managers have the same clean step, for example 'erase_devices' in the GenericHardwareManager and a custom manager, IPA must determine which step should be kept and which should be run in order to prevent running the step multiple times. This patch uses the following filtering logic to decide which step "wins": - Keep the step that belongs to HardwareManager with highest HardwareSupport (larger int) value. - If equal support level, keep the step with the higher defined priority (larger int). - If equal support level and priority, keep the step associated with the HardwareManager whose name comes earlier in the alphabet. Other than individual step priority, picking which step to keep does not actually impact the cleaning run. However, in order to make testing easier, this change ensures deterministic, predictable results. Co-Authored-By: Mario Villaplana <mario.villaplana@gmail.com> Co-Authored-By: Jay Faulkner <jay@jvf.cc> Co-Authored-By: Brad Morgan <brad@morgabra.com> Change-Id: Iaeea4200c38ee22cab72ba81c1dbae3389e675e4
This commit is contained in:

committed by
Jay Faulkner

parent
5fa258b708
commit
61b4387b95
ironic_python_agent
@ -269,7 +269,7 @@ class HardwareManager(object):
|
||||
def get_clean_steps(self, node, ports):
|
||||
"""Get a list of clean steps with priority.
|
||||
|
||||
Returns a list of steps. Each step is represeted by a dict::
|
||||
Returns a list of steps. Each step is represented by a dict::
|
||||
|
||||
{
|
||||
'step': the HardwareManager function to call.
|
||||
@ -289,8 +289,16 @@ class HardwareManager(object):
|
||||
parameter, Ironic will consider False (non-abortable).
|
||||
}
|
||||
|
||||
If multiple hardware managers return the same step name, the priority
|
||||
of the step will be the largest priority of steps with the same name.
|
||||
|
||||
If multiple hardware managers return the same step name, the following
|
||||
logic will be used to determine which manager's step "wins":
|
||||
- Keep the step that belongs to HardwareManager with highest
|
||||
HardwareSupport (larger int) value.
|
||||
- If equal support level, keep the step with the higher defined
|
||||
priority (larger int).
|
||||
- If equal support level and priority, keep the step associated
|
||||
with the HardwareManager whose name comes earlier in the alphabet.
|
||||
|
||||
The steps will be called using `hardware.dispatch_to_managers` and
|
||||
handled by the best suited hardware manager. If you need a step to be
|
||||
executed by only your hardware manager, ensure it has a unique step
|
||||
|
Reference in New Issue
Block a user