Skip to content
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 2crsi-sensors plugin #47

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AtaxyaNetwork
Copy link
Contributor

This plugin allows XCP-ng to:

  • Fetch data from the BMC and parse it into a JSON format
  • Retrieve the IPMI's IP address

Thanks to this plugin, Xen Orchestra can display the BMC's sensors info and the IP address if a 2CRSi Mona server is detected
image

The plugin require the package freeipmi and ipmitool.
Tests requires a Mona server, if you need to test changes, contact me!

Signed-off-by: cecile <cecile@ProjectZero>
Signed-off-by: cecile <cecile@ProjectZero>
Signed-off-by: cecile <cecile@ProjectZero>
Copy link
Contributor

@gthvn1 gthvn1 left a comment

Choose a reason for hiding this comment

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

LGTM :)
Maybe add some simple unit tests like the ones for smartctl.py

@@ -165,6 +165,20 @@ xe host-call-plugin host-uuid=<uuid> plugin=smartctl.py fn=health
{"/dev/sdf": "PASSED", "/dev/sdg": "PASSED", "/dev/sdd": "PASSED", "/dev/sde": "PASSED", "/dev/sdb": "PASSED", "/dev/sdc": "PASSED", "/dev/sda": "PASSED"}
```

## IPMI-sensors parser
A xapi plugin to get information about the host via the BMC
Copy link
Contributor

@gthvn1 gthvn1 Aug 30, 2024

Choose a reason for hiding this comment

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

Maybe add in the README that it requires freeipmi and ipmitool.
What is the error if they are not installed?
My point is that it can be cool, if it is not already the case, that when we run xe host-call-plugin host-uuid=<uuid> plugin=2crsi-sensors.py fn="get_info" the plugin returns a clear message saying "ipmi-sensors not found". So just ensure that in case of error the user will understand that binary is not found.

Copy link
Member

Choose a reason for hiding this comment

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

I can't remember, don't we have it already installed by default in XCP-ng?

Copy link
Member

Choose a reason for hiding this comment

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

ipmitool is installed. Not freeipmi.

@stormi stormi self-requested a review August 30, 2024 15:00
@stormi stormi marked this pull request as draft September 5, 2024 08:10
@stormi
Copy link
Member

stormi commented Sep 5, 2024

I marked this PR as draft since this is still a work in progress, and the interface might still evolve, so a draft will protect us against an accidental merge and packaging.

The review process can continue anyway.

A xapi plugin to get information about the host via the BMC
### `get_info`:
```
xe host-call-plugin host-uuid=<uuid> plugin=2crsi-sensors.py fn="get_info"
Copy link

Choose a reason for hiding this comment

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

IMHO, it would be better and more robust to have a generic IPMI plugin, no need to have logic both in XO and the plugin that will require synchronization on updates.

Possibly accepting a list of fields to return if we want to fetch only a subset.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. And I will check if it is easy and safe to parse the output into JSON otherwise the plugin will return raw data and the parsing will be done on XO side.


@error_wrapped
def get_data(session, args):
data = subprocess.check_output(["ipmi-sensors", "-Q", "--ignore-not-available-sensors", "--ignore-unrecognized-events"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use ipmitool sensor to get the same info? The thing is that freeipmi is not installed by default while ipmitool is. I tested on one machine and it looks like we have even more information with ipmitool sensor. Can you confirm that you also have all infos with your HW?

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.

5 participants