RFC: Change how BMC operations are mapped

It was brought to our attention that Foreman’s BMC operations are weirdly mapped and it is pretty confusing what is a safe operation out of our: Stop, Reset, Poweroff, Reboot. Can you tell just from those words? You can’t, unless you know.

Therefore I propose to change the naming for once and forever that will be friendly and relevant for both hardware BMC’s, Redfish API and virtualization. My thinking is to always use word “force” when it is a dangerous operation (like powering off or powercycle), also choosing words wisely so they are easy to understand in our context.

  • :on (Power on) - IPMI on - virsh start - Redfish On
  • :shutdown (Safe shutdown) - IPMI soft - virsh shutdown - Redfish GracefulShutdown
  • :stop (Force power off) - IPMI off - virsh destroy - Redfish ForceOff
  • :reset (Force power reset) - IPMI cycle - virsh reset - Redfish ForceRestart
  • :mgmt_warm_reset (Management warm reset) - IPMI reset - virsh N/A - Redfish Manager.Reset
  • :mgmt_cold_reset (Management cold reset) - IPMI reset - virsh N/A - Redfish Manager.Reset

Man pages:

Relevant PR: https://github.com/theforeman/foreman/pull/9082


I like the new mapping, and it clearly tells you what to expect.

This also needs to tie into the “Build” dialog, where there’s a mention of reboot, which is actually not possible via IPMI.

Apart from remapping the current power action names, is there a necessity to support “Reboot”?
It would need to be implemented as a “Safe shutdown”, wait until power state reports off, and then “Power on”, which would require a long running background tasks (5 - 10 minutes)

I know this might be too much to ask, but are you able to update your PR according to the proposal? Looks like folks like this, let’s do it. Just simple renaming of symbols + UI elements would be enough, I briefly saw your current PR and I was a bit confused with some other changes - let’s try to keep it small.

Yeah we currently show that checkbox for both VMs and when BMC is available and that is actually wrong. Feel free to file other PR or commit to remove this button for BMC, I don’t think Foreman should be doing “poweroff, wait 1 second, poweron”, servers do take quite some time to shutdown properly.

Just modify this method which will hide the checkbox for BMC:

    def supports_power?
      (uuid && compute_resource_id) || bmc_available?

I have already updated in a separate commit, not sure if you saw already.

I quite like the functionality to reset the server for the build, but probably it’s fine to just remove it, since you still have the option to issue a reset via the power management functions.

Thanks will review soon.

Yeah I don’t see better option than removing this, this operation is not asynchronous so we would probably need to do “shutdown, sleep 10 seconds and hope it was enough, power on” and that would block the HTTP request. That is lame, I would rather not have that feature.

Not sure how todo that in ruby, but in go I would start a subroutine that checks every 10 - 30 sec until the server is off, and then send the power on command.