Proposed Improvements
Proper Exit Code on Failure
The script should exit with code 1 if it fails to fetch Fabric Manager partitions. This ensures downstream processes or users are clearly informed of the failure.
Loop and Logic Refactor
Some for loops are redundant — partitions are listed and iterated over multiple times unnecessarily.
The commands gpus_bdf_to_mod and gpus_mod_to_bdf can be constructed within a single loop, reducing duplication and improving readability.
Rationale
These changes aim to:
Improve clarity and maintainability.
Reduce unnecessary iterations and duplication.
Ensure robust error signaling without altering the intended functionality.