power

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBMCSession

func GetBMCSession(config crawler.CrawlerConfig) (*gofish.APIClient, error)

GetBMCSession returns an already-active gofish BMC client, creating a new one if necessary. This facilitates keeping the clients open for efficiency.

Parameters:

  • config: A CrawlerConfig struct containing the URI, username, password, and other connection details.

Returns: none.

func GetPowerState

func GetPowerState(node CrawlableNode) (redfish.PowerState, error)

PollBMCPowerStates connects to a BMC (Baseboard Management Controller) using the provided configuration, retrieves the ServiceRoot, and retrieves the current power state for each ComputerSystem in each Chassis.

Parameters:

  • node: A CrawlableNode struct containing the target node's xname, index within the BMC, and a crawler.CrawlerConfig struct.

Returns:

  • redfish.PowerState: The current power state of the node. (Custom string subtype)
  • error: An error object if any error occurs during the connection or retrieval process.

func GetResetTypes

func GetResetTypes(node CrawlableNode) ([]redfish.ResetType, error)

ResetComputerSystem connects to a BMC (Baseboard Management Controller) using the provided configuration, retrieves the ServiceRoot, and retrieves the list of supported reset types for the target ComputerSystem.

Parameters:

  • node: A CrawlableNode struct containing the node's xname, index within the BMC, and a CrawlerConfig to connect to the BMC.

Returns:

  • []redfish.ResetType: a slice of Redfish reset types supported on the node.
  • error: An error object if any error occurs during the connection or reset process.

func LogoutBMCSessions

func LogoutBMCSessions()

LogoutBMCSessions logs out all active gofish BMC clients, which we normally like to keep open for efficiency. Logging out should be done as a post-execution cleanup step.

Parameters: none.

Returns: none.

func ParseInventory

func ParseInventory(filename string, dataFormat format.DataFormat) ([]bmc.Node, error)

ParseInventory reads parameters relevant to power control from the kind of YAML file generated by the `collect` command.

Parameters:

  • filename: the path of the YAML file to parse for inventory data, or `-` for stdin.

Returns:

  • []bmc.Node: A slice of structs containing relevant details for connecting to a node via its BMC.
  • error: An error object if any error occurs during the connection or reset process.

func ResetComputerSystem

func ResetComputerSystem(node CrawlableNode, resetType redfish.ResetType) error

ResetComputerSystem connects to a BMC (Baseboard Management Controller) using the provided configuration, retrieves the ServiceRoot, and issues a reset of the specified type to a particular computer system.

Parameters:

  • node: A CrawlableNode struct containing the node's xname, index within the BMC, and a CrawlerConfig to connect to the BMC.
  • resetType: A redfish.ResetType parameter, specifying the manner in which the target ComputerSystem should be reset.

Returns:

  • error: An error object if any error occurs during the connection or reset process.

Types

type CrawlableNode

type CrawlableNode struct {
	ClusterID  string
	ConnConfig crawler.CrawlerConfig
	NodeID     string
}

type PowerInfo

type PowerInfo struct {
	ClusterID string
	State     redfish.PowerState
}

Jump to

Keyboard shortcuts

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