Skip to content

purefa_info: host login ports and preferred-arrays crash fix - #1027

Merged
sdodsley merged 2 commits into
Everpure-Ansible:masterfrom
sdodsley:purefa-info-host-dict
Jul 21, 2026
Merged

purefa_info: host login ports and preferred-arrays crash fix#1027
sdodsley merged 2 commits into
Everpure-Ansible:masterfrom
sdodsley:purefa-info-host-dict

Conversation

@sdodsley

@sdodsley sdodsley commented Jul 17, 2026

Copy link
Copy Markdown
Member
SUMMARY

Two related fixes to the hosts subset of purefa_info:

  • Add logged_in_ports to each host, built from get_ports_initiators, mapping every host WWN/IQN/NQN to the array target ports (e.g. CT0.FC1) it is currently logged into. An empty list means the identifier is not logged in anywhere and can be safely removed. WWNs are matched case- and separator-insensitively.
  • Fix a TypeError ("list indices must be integers or slices, not Reference") raised whenever a host had preferred arrays set. preferred_arrays is a list of Reference objects, but the code indexed the list by the iterated Reference; iterate and use each element's .name instead.

Tests: added logged_in_ports coverage and a preferred_arrays regression test (the existing test only used an empty preferred_arrays, which never exercised the crash).
Closes #1026
Closes #992

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request
COMPONENT NAME

purefa_info.py

@sdodsley sdodsley self-assigned this Jul 17, 2026
@sdodsley sdodsley added bug Something isn't working enhancement New feature or request labels Jul 17, 2026
@sdodsley
sdodsley force-pushed the purefa-info-host-dict branch from 3022fd4 to f2c7590 Compare July 17, 2026 15:53
Two related fixes to the hosts subset of purefa_info:

- Add logged_in_ports to each host, built from get_ports_initiators,
  mapping every host WWN/IQN/NQN to the array target ports (e.g. CT0.FC1)
  it is currently logged into. An empty list means the identifier is not
  logged in anywhere and can be safely removed. WWNs are matched case- and
  separator-insensitively.
- Fix a TypeError ("list indices must be integers or slices, not Reference")
  raised whenever a host had preferred arrays set. preferred_arrays is a
  list of Reference objects, but the code indexed the list by the iterated
  Reference; iterate and use each element's .name instead.

Tests: added logged_in_ports coverage and a preferred_arrays regression
test (the existing test only used an empty preferred_arrays, which never
exercised the crash).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sdodsley
sdodsley force-pushed the purefa-info-host-dict branch from f2c7590 to 78a8bae Compare July 17, 2026 15:54
Removing a single WWN, IQN or NQN from a host was not possible: the
module only ever sent the full desired list in the patch_hosts wwns/
iqns/nqns fields, which *replace* the whole associated list, so it could
not drop one initiator while keeping the rest.

Treat the supplied list as the complete desired set and reconcile to it
using the add_*/remove_* fields (--addwwnlist/--remwwnlist), not the
replacing wwns/iqns/nqns fields (--wwnlist): add only the missing
initiators and remove only the unwanted ones in a single patch. An
unused WWN can now be removed simply by omitting it, and the initiators
that stay are left untouched instead of being removed and re-added.

Signed-off-by: Simon Dodsley <simon@everpuredata.com>
@sdodsley
sdodsley force-pushed the purefa-info-host-dict branch 2 times, most recently from d06de5a to 23a1a93 Compare July 21, 2026 14:01
@sdodsley
sdodsley merged commit 3b20d8c into Everpure-Ansible:master Jul 21, 2026
51 checks passed
@sdodsley
sdodsley deleted the purefa-info-host-dict branch July 21, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

1 participant