domain

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PSTATE_KEYRANGE_START = "x0"
	PSTATE_KEYRANGE_END   = "xz"
)

Variables

View Source
var PowerSequenceFull = []PowerSeqElem{
	{
		Action:    "gracefulshutdown",
		CompTypes: []xnametypes.HMSType{xnametypes.Node},
	}, {
		Action:    "forceoff",
		CompTypes: []xnametypes.HMSType{xnametypes.Node},
	}, {
		Action:    "gracefulshutdown",
		CompTypes: []xnametypes.HMSType{xnametypes.RouterModule, xnametypes.ComputeModule},
	}, {
		Action:    "forceoff",
		CompTypes: []xnametypes.HMSType{xnametypes.RouterModule, xnametypes.ComputeModule},
	}, {
		Action:    "gracefulshutdown",
		CompTypes: []xnametypes.HMSType{xnametypes.Chassis},
	}, {
		Action:    "forceoff",
		CompTypes: []xnametypes.HMSType{xnametypes.Chassis},
	}, {
		Action:    "gracefulshutdown",
		CompTypes: []xnametypes.HMSType{xnametypes.CabinetPDUPowerConnector},
	}, {
		Action:    "forceoff",
		CompTypes: []xnametypes.HMSType{xnametypes.CabinetPDUPowerConnector},
	}, {
		Action: "gracefulrestart",

		CompTypes: []xnametypes.HMSType{xnametypes.Node, xnametypes.RouterModule, xnametypes.ComputeModule, xnametypes.Chassis, xnametypes.CabinetPDUPowerConnector, xnametypes.MgmtSwitch, xnametypes.MgmtHLSwitch, xnametypes.CDUMgmtSwitch},
	}, {
		Action: "gracefulrestart",

		CompTypes: []xnametypes.HMSType{xnametypes.ChassisBMC, xnametypes.NodeBMC, xnametypes.RouterBMC},
	}, {
		Action:    "on",
		CompTypes: []xnametypes.HMSType{xnametypes.CabinetPDUPowerConnector},
	}, {
		Action:    "on",
		CompTypes: []xnametypes.HMSType{xnametypes.Chassis},
	}, {
		Action:    "on",
		CompTypes: []xnametypes.HMSType{xnametypes.RouterModule, xnametypes.ComputeModule},
	}, {
		Action:    "on",
		CompTypes: []xnametypes.HMSType{xnametypes.Node},
	},
}

Functions

func AbortTransitionID

func AbortTransitionID(transitionID uuid.UUID) (pb model.Passback)

This uses Test-And-Set operations to signal an abort to prevent overwriting another instance's store operation. Try a couple times before giving up.

func GetPowerCap

func GetPowerCap() (pb model.Passback)

Get all of the existing power capping tasks

func GetPowerCapQuery

func GetPowerCapQuery(taskID uuid.UUID) (pb model.Passback)

Get a specific power capping task

func GetPowerStatus

func GetPowerStatus(xnames []string,
	pwrStateFilter pcsmodel.PowerStateFilter,
	mgmtStateFilter pcsmodel.ManagementStateFilter) (pb pcsmodel.Passback)

Get power status for given components. Filter by power state and management state. Any undefined filter results in all states for the state category.

xnames: Array of component names for which to get power data pwrStateFilter: Power state filter. mgmtStateFilter: Management state filter. Return: Passback object populated with model.PowerStatus object.

func GetTransition

func GetTransition(transitionID uuid.UUID) (pb model.Passback)

func GetTransitionStatuses

func GetTransitionStatuses() (pb model.Passback)

func Init

func Init(glob *DOMAIN_GLOBALS)

func PatchPowerCap

func PatchPowerCap(parameters model.PowerCapPatchParameter) (pb model.Passback)

Start a power cap patch task for setting power limits for nodes.

func PowerStatusMonitorChangeInterval

func PowerStatusMonitorChangeInterval(newInterval time.Duration) error

Change the power status monitoring interval, on the fly.

func PowerStatusMonitorInit

func PowerStatusMonitorInit(domGlb *DOMAIN_GLOBALS,
	distLockMaxTimeIn time.Duration,
	loggerIn *logrus.Logger,
	sampleInterval time.Duration,
	statusTimeoutOverride int,
	httpRetriesOverride int,
	maxIdleConnsOverride int,
	maxIdleConnsPerHostOverride int) error

Initialize and start power state monitoring.

domGlb: Domain global object (holds lots of handles) distLockMaxTimeIn: Max time to hold dist'd lock before forfeiting loggerIn: Logrus logger object. Will create if nil. sampleInterval: Time between HW status sampling. Return: nil on success, else error message.

func PowerStatusMonitorStop

func PowerStatusMonitorStop()

Stop power status monitoring.

func SnapshotPowerCap

func SnapshotPowerCap(parameters model.PowerCapSnapshotParameter) (pb model.Passback)

Start a power cap snapshot task

func StartRecordsReaper

func StartRecordsReaper()

Periodically runs functions to prune expired transitions and power-capping records and restart abandoned transitions.

func TriggerTransition

func TriggerTransition(transition model.Transition) (pb model.Passback)

Types

type DOMAIN_GLOBALS

type DOMAIN_GLOBALS struct {
	CAUri            string
	BaseTRSTask      *trs_http_api.HttpTask
	RFTloc           *trs_http_api.TrsAPI
	HSMTloc          *trs_http_api.TrsAPI
	RFClientLock     *sync.RWMutex
	Running          *bool
	DSP              *storage.StorageProvider
	HSM              *hsm.HSMProvider
	RFHttpClient     *hms_certs.HTTPClientPair
	SVCHttpClient    *hms_certs.HTTPClientPair
	RFTransportReady *bool
	VaultEnabled     bool
	CS               *credstore.CredStoreProvider
	DistLock         *storage.DistributedLockProvider
	MaxNumCompleted  int
	ExpireTimeMins   int
	PodName          string
}
var GLOB *DOMAIN_GLOBALS

func (*DOMAIN_GLOBALS) NewGlobals

func (g *DOMAIN_GLOBALS) NewGlobals(base *trs_http_api.HttpTask,
	tlocRF *trs_http_api.TrsAPI,
	tlocSVC *trs_http_api.TrsAPI,
	clientRF *hms_certs.HTTPClientPair,
	clientSVC *hms_certs.HTTPClientPair,
	rfClientLock *sync.RWMutex,
	running *bool, dsp *storage.StorageProvider,
	hsm *hsm.HSMProvider, vaultEnabled bool,
	credStore *credstore.CredStoreProvider,
	distLock *storage.DistributedLockProvider,
	maxNumCompleted int, expireTimeMins int,
	podName string)

type HpeActualPowerLimits

type HpeActualPowerLimits struct {
	PowerLimitInWatts *int `json:"PowerLimitInWatts"`
	ZoneNumber        *int `json:"ZoneNumber"`
}

type HpeConfigurePowerLimit

type HpeConfigurePowerLimit struct {
	PowerLimits []HpePowerLimits `json:"PowerLimits"`
}

Structs used to [un]marshal HPE Redfish HpeServerAccPowerLimit.v1_0_0.HpeServerAccPowerLimit data

type HpeError

type HpeError struct {
	Code         string                   `json:"code"`
	Message      string                   `json:"message"`
	ExtendedInfo []HpeMessageExtendedInfo `json:"@Message.ExtendedInfo"`
}

type HpeMessageExtendedInfo

type HpeMessageExtendedInfo struct {
	MessageId string `json:"MessageId"`
}

type HpePowerLimitRanges

type HpePowerLimitRanges struct {
	MaximumPowerLimit *int `json:"MaximumPowerLimit"`
	MinimumPowerLimit *int `json:"MinimumPowerLimit"`
	ZoneNumber        *int `json:"ZoneNumber"`
}

type HpePowerLimits

type HpePowerLimits struct {
	PowerLimitInWatts *int `json:"PowerLimitInWatts"`
	ZoneNumber        *int `json:"ZoneNumber"`
}

type Power

type Power struct {
	OContext string `json:"@odata.context,omitempty"`
	Oetag    string `json:"@odata.etag,omitempty"`
	Oid      string `json:"@odata.id,omitempty"`
	Otype    string `json:"@odata.type,omitempty"`
	Id       string `json:"Id,omitempty"`
	Name     string `json:"Name,omitempty"`

	// Redfish Power.v1_5_4.json
	Description string         `json:"Description,omitempty"`
	PowerCtl    []PowerControl `json:"PowerControl,omitempty"`
	PowerCtlCnt int            `json:"PowerControl@odata.count,omitempty"`

	// HpeServerAccPowerLimit.v1_0_0.HpeServerAccPowerLimit
	Error             *HpeError              `json:"error,omitempty"`
	ActualPowerLimits []HpeActualPowerLimits `json:"ActualPowerLimits,omitempty"`
	PowerLimitRanges  []HpePowerLimitRanges  `json:"PowerLimitRanges,omitempty"`
	PowerLimits       []HpePowerLimits       `json:"PowerLimits,omitempty"`

	// Redfish Control.v1_0_0.Control
	RFControl
}

type PowerControl

type PowerControl struct {
	Oid                 string           `json:"@odata.id,omitempty"`
	Name                string           `json:"Name,omitempty"`
	OEM                 *PowerControlOEM `json:"Oem,omitempty"`
	PowerAllocatedWatts *int             `json:"PowerAllocatedWatts,omitempty"`
	PowerAvailableWatts *int             `json:"PowerAvailableWatts,omitempty"`
	PowerCapacityWatts  *int             `json:"PowerCapacityWatts,omitempty"`
	PowerConsumedWatts  *interface{}     `json:"PowerConsumedWatts,omitempty"`
	PowerLimit          *PowerLimit      `json:"PowerLimit,omitempty"`
	PowerMetrics        *PowerMetric     `json:"PowerMetrics,omitempty"`
	PowerRequestedWatts *int             `json:"PowerRequestedWatts,omitempty"`
}

PowerControl struct used to unmarshal the Redfish Power.v1_5_4 data

type PowerControlOEM

type PowerControlOEM struct {
	Cray *PowerControlOEMCray `json:"Cray,omitempty"`
}

PowerControlOEM contains a pointer to the OEM specific information

type PowerControlOEMCray

type PowerControlOEMCray struct {
	PowerAllocatedWatts   *int               `json:"PowerAllocatedWatts,omitempty"`
	PowerIdleWatts        *int               `json:"PowerIdleWatts,omitempty"`
	PowerLimit            *PowerLimitOEMCray `json:"PowerLimit,omitempty"`
	PowerFloorTargetWatts *int               `json:"PowerFloorTargetWatts,omitempty"`
	PowerResetWatts       *int               `json:"PowerResetWatts,omitempty"`
}

PowerControlOEMCray describes the Mountain specific power information

type PowerLimit

type PowerLimit struct {
	CorrectionInMs *int   `json:"CorrectionInMs,omitempty"`
	LimitException string `json:"LimitException,omitempty"`
	LimitInWatts   *int   `json:"LimitInWatts"`
}

PowerLimit describes the power limit status and configuration for a compute module

type PowerLimitOEMCray

type PowerLimitOEMCray struct {
	Min    *int     `json:"Min,omitempty"`
	Max    *int     `json:"Max,omitempty"`
	Factor *float32 `json:"Factor,omitempty"`
}

PowerLimitOEMCray describes the power limit status and configuration for Mountain nodes

type PowerMetric

type PowerMetric struct {
	AverageConsumedWatts *int `json:"AverageConsumedWatts,omitempty"`
	IntervalInMin        *int `json:"IntervalInMin,omitempty"`
	MaxConsumedWatts     *int `json:"MaxConsumedWatts,omitempty"`
	MinConsumedWatts     *int `json:"MinConsumedWatts,omitempty"`
}

PowerMetric describes the power readings for the compute module

type PowerSeqElem

type PowerSeqElem struct {
	Action    string
	CompTypes []xnametypes.HMSType
	Wait      int
}

type PowerSupply

type PowerSupply struct {
	ID    string
	State model.PowerStateFilter
}

type RFControl

type RFControl struct {
	Oid                 string    `json:"@odata.id,omitempty"`
	ControlDelaySeconds *int      `json:"ControlDelaySeconds,omitempty"`
	ControlMode         string    `json:"ControlMode,omitempty"`
	ControlType         string    `json:"ControlType,omitempty"`
	Id                  string    `json:"Id,omitempty"`
	Name                string    `json:"Name,omitempty"`
	PhysicalContext     string    `json:"PhysicalContext,omitempty"`
	SetPoint            *int      `json:"SetPoint,omitempty"`
	SetPointUnits       string    `json:"SetPointUnits,omitempty"`
	SettingRangeMax     *int      `json:"SettingRangeMax,omitempty"`
	SettingRangeMin     *int      `json:"SettingRangeMin,omitempty"`
	Status              *StatusRF `json:"Status,omitempty"`
}

RFControl struct used to unmarshal the Redfish Control.v1_0_0.Control data

type RFControlsDeep

type RFControlsDeep struct {
	Members []RFControl `json:"Members"`
}

type StatusRF

type StatusRF struct {
	Health       string `json:"Health,omitempty"`
	HealthRollUp string `json:"HealthRollUp,omitempty"`
	State        string `json:"State,omitempty"`
}

StatusRF struct used to unmarshal health info from Redfish Control.v1_0_0

type TransitionComponent

type TransitionComponent struct {
	PState        *model.PowerStatusComponent
	HSMData       *hsm.HsmData
	PowerSupplies []PowerSupply
	Task          *model.TransitionTask
	Actions       map[string]string
	ActionCount   int // Number of actions until task competion
}

Jump to

Keyboard shortcuts

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