chassis-psu: New Functions for MultiChassis App
Implemented several functions for monitoring power supplies in
multi-chassis systems. Added a new main function, made minor
modification to the PowerSupply class, and added several functions to
the Chassis and ChassisManager classes.
The following is a summary of each object class new addition or modified
functions:
ChassisManager:
- initChassisPowerMonitoring(): Loops through all the chassis in the
system and initializes power monitoring process for each chassis's
PSUs.
Chassis:
- initPowerMonitoring(): Subscribe to D-Bus power change and initialize
power monitoring.
- supportedConfigurationInterfaceAdded(): Handle addition of supported
configuration and update missing PSUs.
- psuInterfaceAdded(): Handle addition of PSUs on D-Bus.
- validatePsuConfigAndInterfacesProcessed(): Validate the PSU
configuration and reset validation timer if power is on, supported
configs and have PSUs.
- analyzeBrownout(): Analyze PSUs for a brownout failure and log error.
- syncHistory(): Toggles the GPIO to sync power supply input history
readings.
- setInputVoltageRating(): Inform each PSUs to set its PSU input.
- createError(): Create OpenBMC error.
- hasRequiredPSUs(): TODO
- updateMissingPSUs(): Update PSU inventory.
- getSupportedConfiguration(): Retrieve supported configuration from
D-BUS and matches chassis ID with the current chassis id to update
chassis configuration.
- saveChassisName(): Save chassis short name in the class.
- powerStateChanged(): Handle for power state property changes.
- attemptToCreatePowerConfigGPIO(): Attempt to create GPIO
PowerSupply:
- PowerSupply(): Added additional class constructors. The constructors
have the same parameters as the original, except that the new
constructor include an extra parameter chassis short name.
- The PowerSupply class functions implementation remains the same as
the original, except for minor change in
PowerSupply::setupInputPowerPeakSensor(), where the sensorPath was
modified to include chassis name.
Test in simulation:
- Verified supported configuration added, where it polpulates
supported properties and updates PSUs changes.
- Validated some of the brownout functionality using fault injection.
- Validated the PowerSupply class sets the appropriate input voltage
for the target chassis PSUs.
- Verified that the chassis name is included in the PSU power input
peak sensors on D-bus.
Change-Id: I75a1ab1dd004767f072e35f3ce2c83ff281eb1ca
Signed-off-by: Faisal Awada <faisal@us.ibm.com>
diff --git a/phosphor-power-supply/new_main.cpp b/phosphor-power-supply/new_main.cpp
new file mode 100644
index 0000000..638f971
--- /dev/null
+++ b/phosphor-power-supply/new_main.cpp
@@ -0,0 +1,28 @@
+#include "chassis_manager.hpp"
+
+#include <CLI/CLI.hpp>
+#include <phosphor-logging/lg2.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdeventplus/event.hpp>
+
+#include <filesystem>
+
+using namespace phosphor::power;
+
+int main()
+{
+ using namespace phosphor::logging;
+
+ CLI::App app{"OpenBMC Power Supply Unit Monitor"};
+
+ auto bus = sdbusplus::bus::new_default();
+ auto event = sdeventplus::Event::get_default();
+
+ // Attach the event object to the bus object so we can
+ // handle both sd_events (for the timers) and dbus signals.
+ bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
+
+ chassis_manager::ChassisManager chassis_manager(bus, event);
+
+ return chassis_manager.run();
+}