-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add a plugin to get information from ipmitool #48
base: master
Are you sure you want to change the base?
Conversation
@AtaxyaNetwork , do you think that it will be possible to test this plugin on a 2crsi server in order to check that output are correct? Thanks a lot for your great help. |
For info, @AtaxyaNetwork tested it several weeks ago and it looks ok. Don't know if it needs to be checked with XO team but for me it looks ok to merge it. @stormi I added you as reviewer but feel free to add someone else :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is ipmitool guaranteed to report information structured as expected by the code on every XCP-ng host? I see no error handling outside the automatic one that will report the exception raised by python. I just tried on a nested XCP-ng VM and got
[15:51 xcpng-ci-82-b1 ~]# ipmitool sdr list Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
. - Code changes to this repository must come with unit tests in the same repository. Ideally also covering error handling.
This PR supersedes #47 |
@stormi in case of error it raises a |
In the Readme I see:
|
|
Yes, but then errors that mean nothing to users will be displayed to users in XO. We'll likely need something better than |
You will have "Error parameters: Command '['ipmitool', 'sdr', 'list']' failed with code: 1, stdout: '', stderr: 'Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory". It is the error parameters returned from the wrapper. What should I put instead? I mean it is the error :) |
Isn't XO that should handle this better? Not sure to see what you want instead of the "real error"? |
Depends what the API user (XO) would like. I think they would appreciate it if we provided a way to discriminate between "not supported on this hardware" and unexpected errors on supported hardware, for example. |
So we should add some XO people to review right? |
and I'm not sure to know how we can discriminate between "not supported on this hardware" and unexpected errors on supported hardware. |
9b30a15
to
e4a6140
Compare
The PR LGTM - I'd like some error cases tested as @stormi said. Regarding the error report - IDK how this will be exposed in XO (I think we need more context) so hard to tell - if the error is directly presented to the user as is then a better error message would be preferrable but if its an internal thin in XO that will be procesed before giving a result then the translation can be done their as well. |
Another argument for better feature support detection: I think "normal" errors will pollute host logs, so it would seem better to me if XO would first ask "do you have an IPMI device?" and then only if true asks for the data. |
Yes it is planed. I'm waiting comment from XO guys (that I already contacted and I should have feedback this week) before implementing error case because I don't know yet what they are expected... |
Or as suggested before instead of a new function I can return an explicit string if I have an error "Could not open device" and only raise an exception for other errors. It won't cover all unexpected errors (maybe it will if the only "normal" error is the missing device) but it is an improvement. |
e4a6140
to
8d52e36
Compare
dde7c0a
to
47e8413
Compare
47e8413
to
d098e35
Compare
After discussing with XO team (Mathieu) I will add a new method to ensure that hardware supports IPMI. This method |
What could be even better is still checking in every method that IPMI is available and if not raise a XenAPI.Failure explaining it's not. |
Currently if IPMI is not available when running a command you will have this XenAPIplugin error:
So you suggest to replace the stderr of this error for something more clear? Because in this particular case the |
d098e35
to
77697c6
Compare
|
15efa2f
to
0622a7f
Compare
21f6007
to
d9d4d83
Compare
d9d4d83
to
65aa4e8
Compare
All tests added. The last modification is when an error occured when trying to get information about a sensor that doesn't exist. |
65aa4e8
to
17afa5c
Compare
- is_ipmi_device_available: check that your system supports IPMI by running `ipmitool power state` - returns true if IPMI is supported, false otherwise - get_all_sensors: run `ipmitool sdr list` - returns a JSON string with all sensors or raise an error - get_sensor: run `ipmitool sdr get <sensor>` - returns details about sensors passed as parameter or raise an error - get_ipmi_lan: run `ipmitool lan print` - returns network info of the IPMI server as a JSON or raise an error Signed-off-by: Guillaume <[email protected]>
17afa5c
to
959a0bd
Compare
For information the last version of the plugin has been tested successfully by @AtaxyaNetwork 👍 on her machine. |
Commands are:
ipmitool sdr list
- returns a JSON string with all sensorsipmitool sdr get <sensor>
- returns details about sensors passed as parameter