ipmi

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: GPL-3.0, LGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

func CheckAction(action string) error

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
	// Fanout is the --fanout of the command line, 0 when none was given:
	// ipmipower then asks no more processors than that at once, which it
	// otherwise decides by itself. ipmitool keeps to Spec.MaxConcurrent,
	// which --fanout has lowered already.
	Fanout int
	// Answered, when it is set, is told the status of each processor as
	// the line that answers for it arrives, before Power returns, so that
	// a display can count the processor done then. It is called from the
	// goroutines that read the backend's output, one per stream, perhaps
	// at once. The lines are read by the rule Power reads them by, so
	// what it is told is what Power returns for that processor; the
	// backends print one line for each.
	Answered func(Status)
}

Backend runs an IPMI tool on a host that can reach the service network.

func (Backend) Format added in v0.4.0

func (b Backend) Format(f fmt.State, _ rune)

Format prints the backend without the password, whatever the verb, so that a log line or an error that prints one cannot give the account away.

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 contacting a thousand processors one ssh connection at a time is what made the shell version unusable at scale: ipmipower takes a host list and fans out by itself, and ipmitool, which takes one host, is run for Spec.MaxConcurrent processors at a time on the backend's host.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL