Skip to content

Return of ipmi#3373

Merged
mchf merged 13 commits intomasterfrom
return-of-ipmi
Apr 14, 2026
Merged

Return of ipmi#3373
mchf merged 13 commits intomasterfrom
return-of-ipmi

Conversation

@mchf
Copy link
Copy Markdown
Contributor

@mchf mchf commented Apr 10, 2026

Problem

There used to be support for Ipmi reporting (#2490) which was lost during transformation of manager service from ruby to rust.

Solution

Ipmi code rewritten from ruby to rust and hooked into the manager service

TODO

  • changelog (will be added once we get close to end of the review ;-))

Testing

  • Tested manually

@mchf mchf requested a review from imobachgs April 10, 2026 15:46
Copy link
Copy Markdown
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

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

I have a few comments about the overall approach.

You are using an empty struct which does not hold any kind of state. Actually, the &self arguments are not needed (e.g., check is_available).

I guess you want to somehow group all those functions together and in the future you might want to keep some state (e.g., caching is_available or something like that).

Additionally, you are using some hard-coded values (two paths). What about moving those paths to the struct itself?

struct Ipmi {
  tool: PathBuf, // feel free to use better names
  dev: PathBuf
}

impl Ipmi {
  fn new(tool: &str, dev: &str) -> Self { // you can use a String if you prefer
    Self {
      tool: tool.to_string(),
      dev: dev.to_string()
    }
  }
}

impl Default for Impi {
  fn default() -> Self {
    Self::new("/usr/bin/ipmitool", "/dev/ipmi0")
  }
}

This approach would enable you to write unit tests (that are actually missing).

const IPMI_ABORTED: u8 = 0x09;
const IPMI_FAILED: u8 = 0x0A;

pub fn new() -> Self {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about returning an error if the ipmi is not available? In that case, this struct does not have any usage. I do not have a strong opinion about this, it is just a suggestion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well ipmi is kind of optional from our POV and in fact we do not care whether it is available or not ... And wrapping return value into a Result would make coding little bit more noisy ;-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I understand, that's why I say it is just a suggestion. All those functions are now a no-op. At least I would log in the send_command function that IPMI is not available. Or if you prefer, you could call is_available when the manager starts printing whether it is supported or not.

@mchf
Copy link
Copy Markdown
Contributor Author

mchf commented Apr 13, 2026

I have a few comments about the overall approach.

You are using an empty struct which does not hold any kind of state. Actually, the &self arguments are not needed (e.g., check is_available).

I guess you want to somehow group all those functions together and in the future you might want to keep some state (e.g., caching is_available or something like that).

yes, that was the idea. However originally I wanted to do a (kind of) 1:1 version of original ruby code. As it wasn't according to your taste I've added basic update according to your comments

Copy link
Copy Markdown
Contributor

@imobachgs imobachgs left a comment

Choose a reason for hiding this comment

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

I am still not convinced by the no-op and, more important, the lack of tests.

But please, do not merge until you can try a full installation.

imobachgs
imobachgs previously approved these changes Apr 14, 2026
@imobachgs imobachgs dismissed their stale review April 14, 2026 06:35

Please, add changes entry.

- jsc#PED-12285
- re-introduced initial implementation for installer state status
report via IPMI. Original implementation lost due to transition
from ruby to rust.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
from ruby to rust.
from Ruby to Rust.

@mchf mchf merged commit ced2c1f into master Apr 14, 2026
17 checks passed
@mchf mchf deleted the return-of-ipmi branch April 14, 2026 11:36
@imobachgs imobachgs mentioned this pull request Apr 14, 2026
imobachgs added a commit that referenced this pull request Apr 14, 2026
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