[IPMITOOL] Always check state before power actions
Opened this issue · 3 comments
It appears that with some vendors/models an ipmitool chassis power off
call to an already off machine will cause an error: Set Chassis Power Control to Down/Off failed: Command not supported in present state
. In testing, this was only with some Dell models. The HP and Supermicro's i tested against did not error like this. They returned successfully: Chassis Power Control: Down/Off
.
We should consider adding chassis power status
checks before running power on, off, reset, cycle commands.
@joelrebel i'm keen to know your opinion/experience here.
It looks like we could add back the following snippet and silently ignore if the device is off unlike previously where it errored.
s, err := i.IsOn(ctx)
if err != nil {
return false, err
}
Im a bit late to this, but yes to adding a check that makes bmclib more consistent across hardware.