Skip to content

Conversation

@nicolamos
Copy link
Contributor

Referring to issue #171, I provide a patch for this.

  • New class PowerControl
  • Filling the fields in the get_single_chassi_power function, similarly to PowerSupply.

I got a bit confused about how to deal with dict subelements which get rendered as strings (but they are not valid JSON because of quoting issues).

In particular, I am referring to the following elements in PowerControl.

   "PowerLimit": {
      "CorrectionInMs": 0,
      "LimitException": "HardPowerOff",
      "LimitInWatts": 32767
    },
    "PowerMetrics": {
      "AverageConsumedWatts": 102,
      "IntervalInMin": 1,
      "MaxConsumedWatts": 113,
      "MinConsumedWatts": 93
    }

@nicolamos nicolamos marked this pull request as ready for review July 26, 2025 17:34
@bb-Ricardo
Copy link
Owner

Wow, fantastic. I'll have a look in the next days. Thank you for putting in the work ⭐️

@nicolamos nicolamos force-pushed the power_control_element branch from 7edcdf1 to ed14135 Compare July 27, 2025 10:52
@nicolamos
Copy link
Contributor Author

I also added special case for Supermicro PSU models which do not provide the power capacity through Redfish API.
I don’t know if this is good idea to keep the information here or should be dealt with downstream in applications.

… power data processing

Refactor session handling and enhance vendor detection from chassis data
@nicolamos nicolamos force-pushed the power_control_element branch from 19615fe to d20575f Compare July 28, 2025 10:27
@nicolamos
Copy link
Contributor Author

nicolamos commented Jul 28, 2025

Added fallback for vendor identification.
Some Supermicro models apparently do not provide Oem nor Vendor information at root level. So we can grab the Manufacturer field from the Chassis.
This means early query Chassis in vendor discovery, before the full system discover has been performed.

@bb-Ricardo bb-Ricardo changed the base branch from main to next-release July 28, 2025 21:58
Comment on lines 18 to 28
_supermicro_power_supply_specs = {
"PWS-2K22A-1R": {"capacity_in_watt": 2200, "efficiency_percent": 96},
"PWS-1K21P-1R": {"capacity_in_watt": 1200, "efficiency_percent": 92},
"PWS-2K02P-1R": {"capacity_in_watt": 2000, "efficiency_percent": 91},
"PWS-2K02F-1R": {"capacity_in_watt": 2000, "efficiency_percent": 94},
"PWS-1K03B-1R": {"capacity_in_watt": 1000, "efficiency_percent": None},
"PWS-407P-1R": {"capacity_in_watt": 400, "efficiency_percent": None},
# Add more as needed...
}


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, this would fit petter into classes/vendor.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes sense, of course. Would using config files/external resources useful here to handle this kind of data?

model = ps.get("Model") or part_number
last_power_output = ps.get("LastPowerOutputWatts") or ps.get("PowerOutputWatts")
capacity_in_watt = ps.get("PowerCapacityWatts")
efficiency_percent = ps.get("EfficiencyPercent", None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the None in the end could be removed as it is the default.

Comment on lines 585 to 590
chassis = self.get_system_properties("chassis")
if len(chassis) > 0:
# try to get vendor from first chassis
chassis_data = self.get(chassis[0])
if chassis_data is not None:
vendor_string = chassis_data.get("Manufacturer", None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be compacted to:

vendor_string = grab(self.get_system_properties, "chassis.0.Manufacturer")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that we don’t have the chassis data at this point. We have to fetch it from Redfish first.
So I have updated the code to be more concise using grab, but still we have to call the GET first. Or am I missing something?

@nicolamos nicolamos requested a review from bb-Ricardo July 29, 2025 08:40
@nicolamos nicolamos force-pushed the power_control_element branch from 08b9d88 to f4aeee0 Compare July 29, 2025 08:43
@bb-Ricardo bb-Ricardo merged commit 98c8a4d into bb-Ricardo:next-release Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants