Skip to content

Commit dbf6df9

Browse files
authored
Merge pull request #2767 from rackerlabs/panos-ha-cabling-maintenance
fix(ironic): Put Palo Alto HA cabling faults into maintenance so DC ops can see them PUC-2222
2 parents 4abe68d + 015dfb8 commit dbf6df9

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

‎python/ironic-understack/ironic_understack/drivers/panos_inspect.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,8 @@ def _validate_and_pair_ha(
798798
The enroll-fw workflow will read ha_operational from both devices
799799
and decide whether to promote.
800800
801-
:raises: Logs warnings but does not raise - allows inspection to complete
801+
:raises: HardwareInspectionFailure for a cabling fault (wrong peer, same
802+
switch). Other failures are recorded and inspection completes.
802803
"""
803804
# Default to False - only set True if all checks pass
804805
extra["ha_operational"] = False
@@ -842,7 +843,7 @@ def _validate_and_pair_ha(
842843
)
843844
LOG.warning("[node:%s] %s", node.uuid, reason)
844845
node.last_error = reason
845-
return
846+
raise exception.HardwareInspectionFailure(reason)
846847

847848
LOG.info("[node:%s] HA peer connected: %s", node.uuid, peer_serial)
848849

@@ -983,6 +984,8 @@ def _validate_and_pair_ha(
983984
# Clear any previous failure reason
984985
node.last_error = None
985986

987+
except exception.HardwareInspectionFailure:
988+
raise # a cabling fault stops inspection
986989
except Exception as e:
987990
LOG.exception(
988991
"[node:%s] HA validation/pairing failed: %s",

‎python/ironic-understack/ironic_understack/tests/test_panos_inspect.py‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,10 @@ def test_a_healthy_pair_is_operational(mocker, task):
221221
("change", "reason"),
222222
[
223223
({"peer": ("S2", "down")}, "HA peer connection not up"),
224-
({"peer": ("S9", "up")}, "HA peer serial mismatch"),
225224
({"mate_peer": ("S9", "up")}, "Mate peer serial mismatch"),
226225
({"mate_peer": ("S1", "down")}, "Mate peer connection not up"),
227-
({"mate_switch": "leaf-1"}, "same switch"),
228226
],
229-
ids=["peer-down", "wrong-peer", "mate-sees-other", "mate-down", "same-switch"],
227+
ids=["peer-down", "mate-sees-other", "mate-down"],
230228
)
231229
def test_an_unhealthy_pair_is_not_operational(mocker, task, change, reason):
232230
device = _ha_pair(mocker, task, **change)
@@ -237,6 +235,25 @@ def test_an_unhealthy_pair_is_not_operational(mocker, task, change, reason):
237235
assert reason in node.last_error
238236

239237

238+
@pytest.mark.parametrize(
239+
("change", "reason"),
240+
[
241+
({"peer": ("S9", "up")}, "HA peer serial mismatch"),
242+
({"mate_switch": "leaf-1"}, "same switch"),
243+
],
244+
ids=["wrong-peer", "same-switch"],
245+
)
246+
def test_a_cabling_fault_fails_inspection(mocker, task, change, reason):
247+
device = _ha_pair(mocker, task, **change)
248+
249+
with pytest.raises(exception.HardwareInspectionFailure, match=reason):
250+
_validate_ha(task, device)
251+
252+
assert task.node.extra["ha_operational"] is False
253+
assert reason in task.node.last_error
254+
task.node.save.assert_called_once()
255+
256+
240257
def test_a_local_link_down_never_contacts_the_mate(mocker, task):
241258
device = _ha_pair(mocker, task, hsci="down")
242259

0 commit comments

Comments
 (0)