diff options
| author | Josh Gachnang <josh@pcsforeducation.com> | 2015-06-09 15:39:38 -0700 |
|---|---|---|
| committer | Jay Faulkner <jay@jvf.cc> | 2016-01-14 13:12:52 -0800 |
| commit | 61b4387b95a7a147a8621dbc538ed30b3bf5c90a (patch) | |
| tree | 893a8f308cabba091df88de4165b7388c0d55e63 /ironic_python_agent/hardware.py | |
| parent | 5fa258b7087e610625e0277efb197f87db08f1ea (diff) | |
| download | ironic-python-agent-61b4387b95a7a147a8621dbc538ed30b3bf5c90a.tar.gz | |
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
Diffstat (limited to 'ironic_python_agent/hardware.py')
| -rw-r--r-- | ironic_python_agent/hardware.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index 0e759463..3f0f0771 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -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 |
