1# Multi-Chassis Support for phosphor-psu-monitor 2 3## Current State 4 5Currently, **phosphor-psu-monitor** operates on a **single chassis**. 6 7- It gets the PSUs device access information (such as PSU I2CBus and I2CAddress) 8 and allowed PSU configurations using interfaces hosted by **entity manager** 9- The phosphor-psu-monitor uses a **fixed object path**, appended with the PSU 10 number, to access **inventory manager**. 11- Example of current PSU path: 12 13```text 14/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 15 16``` 17 18## Goal: Support Multi-Chassis PSUs 19 20To support **multi-chassis**, the **phosphor-psu-monitor** requires the 21following changes: 22 23- Define Chassis class 24- Modify the **PSUManager** class to instantiate one **Chassis class** per 25 physical chassis. 26- Find all PSUs associated with each chassis. 27- Update the PSUs status on DBus with appropriate path i.e. 28 29```text 30/xyz/openbmc_project/inventory/system/chassis1/motherboard/powersupply1 31``` 32 33## Changes Required 34 35### 1. Define Chassis Class 36 37- Chassis class constructor take parameters D-Bus connection object, chassis 38 number, and object path 39- Vector of powerSupply instances 40- Functions to get and add PSUs 41- Function to get chassis status 42 43### 2. Modify PSUManager Class 44 45- Add method to retrieve a list of chassis objects from the **inventory 46 manager** and store them in a vector of chassis. Each chassis object listens 47 for D-BUS events to track chassis PGOOD Status. 48- Retrieve the PSU configurations from **entity manager** 49- Find all PSUs associated with chassis from **inventory manager** (using 50 [`getSubTree`](https://github.com/openbmc/phosphor-power/blob/master/utility.hpp)) 51 and add them to vector in the chassis object. **getSubTree** is a function 52 interacts with the D-Bus object mapper to retrieve all objects under a 53 specified path that implement interface to certain depth. 54 55### 3. Update Monitoring Logic 56 57- The PSUManager object loops over all **chassis** that are present and have 58 standby power. The **phosphor-psu-monitor** app monitors all PSUs associated 59 with the chassis to: 60 - Monitor Presence 61 - Create appropriate journal entries 62 - Create PELs for faults if the chassis is powered on 63 64### 4. DBus Updates 65 66- Update/publish **PSU sensors, presence and VPD information** on D-Bus. 67- Ensure properties **reflect multi-chassis** support. 68 69Note: The phosphor-psu-monitor logic should remain the same when adding support 70for multi chassis. 71 72### 5. PowerSystemInputs Interface 73 74- TBD 75 76### 6. Error Handling 77 78- Ensure any **error** references the **correct PSU inventory path**, e.g., 79 - `/xyz/openbmc_project/inventory/system/chassis0/powersupply0` 80 - `/xyz/openbmc_project/inventory/system/chassis1/powersupply3` 81 82### 7. Log Messages 83 84- Update journal messages to reflect **appropriate chassis**. 85 86--- 87 88## Summary 89 90**phosphor-psu-monitor** must be enhanced to dynamically: 91 92- Discover chassis, and maintain state of each chassis and react accordingly. 93- Monitor PSUs across all chassis 94- Update DBus and error logs accordingly. 95