New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set powercap shouldn't except the values out of range #43
Comments
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. This would fix the issue: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. This would fix the issue: openbmc#43 Signed-off-by: Yi Li <adamliyi@msn.com>
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. This would fix the issue: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. This would fix the issue: openbmc#43 Signed-off-by: Yi Li <adamliyi@msn.com>
Please see PR: #50 curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [ 1900 ]}" https://9.3.23.24/org/openbmc/sensors/hot/PowerCap/action/setValue |
500 internal error is not really accepted, we should through 4xx series error. You can refer https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error to understand more about errors. |
Thanks Manjunath for reminding. I need to check with Brad. |
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. This would fix the issue: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. Need to specify the exception name to trigger a '400' return code. This would fix the issue: openbmc#43 Signed-off-by: Yi Li <adamliyi@msn.com>
Updated the PR. curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d "{"data": [ 2000 ]}" https://9.3.23.24/org/openbmc/sensors/host/PowerCap/action/setValue |
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. This would fix the issue: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. Need to specify the exception name to trigger a '400' return code. This would fix the issue: openbmc#43 Signed-off-by: Yi Li <adamliyi@msn.com>
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. Fixes: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. Need to specify the exception name to trigger a '400' return code. Fixes: openbmc#43 Add code to validate input user powercap value. Changed the logic of "reading powercap" using PowerCap.getValue(). Previously PowerCap.getValue() returns current user set powercap value. Now PowerCap.getValue() returns actual system powercap reading from OCC. Signed-off-by: Yi Li <adamliyi@msn.com>
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. Fixes: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. Need to specify the exception name to trigger a '400' return code. Fixes: openbmc#43 Add code to validate input user powercap value. Changed the logic of "reading powercap" using PowerCap.getValue(). Previously PowerCap.getValue() returns current user set powercap value. Now PowerCap.getValue() returns actual system powercap reading from OCC. Signed-off-by: Yi Li <adamliyi@msn.com>
I just verified the tests on that machine for issue #43 and working fine. Test Occ Powercap :: This suite is for testing OCC: Power capping ... | PASS | 6 tests total, 6 passed, 0 failedOutput: /home/manjunath/git/openbmc-automation/output.xml |
Why this issue has been closed? is code already merged? |
…ap object Currently master OCC hwmon sysfs path is hardcoded to '/sys/class/hwmon/hwmon3/'. This make the '/org/openbmc/sensors/host/PowerCap' interface cannot work when master OCC is initilized as hwmon device other than 'hwmon3'. 'usr_powercap' attribute should be searched when OCC is active. When skeleton creates 'PowerCap' objects, OCC may not be active. So do the search each time setting power cap. Raise an exception when there is no 'user_powercap' attribute. Fixes: openbmc#42 Also raise an exception when setting power cap fails. The exception will be returned to REST API caller. Need to specify the exception name to trigger a '400' return code. Fixes: openbmc#43 Add code to validate input user powercap value. Changed the logic of "reading powercap" using PowerCap.getValue(). Previously PowerCap.getValue() returns current user set powercap value. Now PowerCap.getValue() returns actual system powercap reading from OCC. Signed-off-by: Yi Li <adamliyi@msn.com>
We have seen that set powercap call is excepting any values outside range like less than min or more than supported max powercap value. This error handling should be done in the REST API level to return with error instead of accepting as 200.
Note - though values are not written into the /org/openbmc/sensors/host/PowerCap which is expected but REST should also through Error message.
The text was updated successfully, but these errors were encountered: