CASMHMS-6148: Parse PowerConsumedWatts for any data type and intialize pcap min/max appropriately #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary and Scope
The Paradise redfish Power endpoint presents the consumed watts value as a float. All prior platforms have presented it as an integer value and thus the PCS data structure for holding it declared it as an int. This caused json.Unmarshal() to fail on Paradise because it enforces strict type checking.
The fix here is to change the int type to an interface{} type so that it can hold a value of any type. We then convert any floats we read to an int (by rounding). We chose to do this rather than simply changing the type from an int to a float so that we don't break any customer code that may be doing the same thing we were doing (expecting an int rather than a float).
Additionally, this PR contains a fix to initialize the power cap min/max values to -1. This is necessary in order for requests against non-oem platforms to work properly in doPowerCapTask() where checks are made against these values.
Adopted app version 2.4.0 for CSM 1.5.2 (helm chart 2.0.9)
Adopted app version 2.4.0 for CSM 1.6 (helm chart 2.1.6)
Issues and Related PRs
Testing
Tested on:
Test description:
With a patched SMD in place, verified that PCS would convert floats to ints properly when ran against Paradise nodes. Then verified that PCS could power cap both Paradise and Bard Peak compute nodes.
Risks and Mitigations
Are there known issues with these changes? Any other special considerations?
Pull Request Checklist