Documentation
¶
Overview ¶
Package ipmi drives the FreeIPMI and ipmitool backends that talk to service processors over the management network.
The tools run on the host that has a route into that network, usually the management gateway, and clusterctl reaches them over ssh. The password never appears in an argument vector: it is streamed over stdin into a file the backend reads and that is removed again, because ps on a shared gateway shows every argument to every user.
Index ¶
Constants ¶
const ( ActionStatus = "status" ActionOn = "on" ActionOff = "off" ActionCycle = "cycle" ActionReset = "reset" // ActionSoft asks the operating system to shut down, which ipmitool // calls soft and FreeIPMI calls soft-shutdown. ActionSoft = "soft" )
The power actions the backends understand.
const ( BackendIpmipower = "ipmipower" BackendIpmitool = "ipmitool" )
Backends names the supported backends.
Variables ¶
This section is empty.
Functions ¶
func Actions ¶
func Actions() []string
Actions lists the power actions, for help text and completion.
func CheckAction ¶ added in v0.3.0
CheckAction reports whether the backends understand a power action.
Types ¶
type Backend ¶
type Backend struct {
// Runner executes the command, usually over ssh.
Runner transport.Runner
// Target is the host the tool runs on.
Target transport.Target
// Spec is the IPMI configuration of the site.
Spec v1alpha1.IPMISpec
// Username and Password authenticate with the service processors.
Username string
Password string
}
Backend runs an IPMI tool on a host that can reach the service network.
func (*Backend) Power ¶
func (b *Backend) Power(ctx context.Context, action string, bmcs *nodeset.NodeSet) ([]Status, error)
Power runs a power action against a set of service processors, and returns one status for every processor of the set, in the order of the set.
The whole set is handed to the backend in one call, because both tools take a host list and contacting a thousand processors one ssh connection at a time is what made the shell version unusable at scale.
A processor counts as answered only when the backend printed an answer known to mean success for this action. Anything else it printed is the processor's error, and a processor it printed nothing for failed too, whatever the backend's exit code was.
type Status ¶
type Status struct {
// BMC is the service processor that was asked.
BMC string `json:"bmc" yaml:"bmc"`
// State is the power state it reported, "ok" for an action it
// accepted, or "unknown" when it failed.
State string `json:"state" yaml:"state"`
// Err is set when the processor did not answer with success.
Err string `json:"error,omitempty" yaml:"error,omitempty"`
// Cause is the error behind Err. It carries the exit code: a
// processor the backend never reported because the backend or the
// connection to its host failed is a transport failure.
Cause error `json:"-" yaml:"-"`
}
Status is what one service processor answered.