hsm

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HSM_MAX_COMPONENT_QUERY = 2000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompQuery

type CompQuery struct {
	ComponentIDs []string `json:"ComponentIDs"`
}

type HSMProvider

type HSMProvider interface {
	Init(glb *HSM_GLOBALS) error
	Ping() error
	ReserveComponents(compList []ReservationData) ([]*ReservationData, error)
	ReleaseComponents(compList []ReservationData) ([]*ReservationData, error)
	CheckDeputyKeys(comp []ReservationData) error
	FillComponentEndpointData(hd map[string]*HsmData) error
	GetStateComponents(xnames []string) (base.ComponentArray, error)
	FillPowerMapData(hd map[string]*HsmData) error
	FillHSMData(xnames []string) (map[string]*HsmData, error)
}

type HSM_GLOBALS

type HSM_GLOBALS struct {
	SvcName           string
	Logger            *logrus.Logger
	Reservation       *reservation.Production
	Running           *bool
	LockEnabled       bool
	SMUrl             string
	SVCHttpClient     *hms_certs.HTTPClientPair
	MaxComponentQuery int
}

type HSMv2

type HSMv2 struct {
	HSMGlobals HSM_GLOBALS
}

func (*HSMv2) CheckDeputyKeys

func (b *HSMv2) CheckDeputyKeys(compList []ReservationData) error

Check each component's deputy key for validity. Any error results in all components being considered invalid (this would be for some sort of SM commmunication error). Otherwise, each item in the list is checked and if it is not valid, it's Error field is set.

NOTE: not having a deputy key associated with a component is not an error. This func is only checking non-nil keys for validity.

func (*HSMv2) FillComponentEndpointData

func (b *HSMv2) FillComponentEndpointData(hd map[string]*HsmData) error

Given a map of previously-created HSM component data, populate endpoint information in each one.

TODO: We currently don't return any components NOT found in HSM. Should we do so, and populate minimal data + the Error field?

func (*HSMv2) FillHSMData

func (b *HSMv2) FillHSMData(xnames []string) (map[string]*HsmData, error)

Fill in various data for each requested component from HSM.

func (*HSMv2) FillPowerMapData added in v1.4.2

func (b *HSMv2) FillPowerMapData(hd map[string]*HsmData) error

Fetch power map from HSM.

func (*HSMv2) GetStateComponents

func (b *HSMv2) GetStateComponents(xnames []string) (base.ComponentArray, error)

Fetch component info from HSM.

func (*HSMv2) Init

func (b *HSMv2) Init(globals *HSM_GLOBALS) error

func (*HSMv2) Ping

func (b *HSMv2) Ping() (err error)

func (*HSMv2) ReleaseComponents

func (b *HSMv2) ReleaseComponents(compList []ReservationData) ([]*ReservationData, error)

The passed-in list should only contain components that don't have a deputy key. If no error is returned, caller must check all components to see if any of them failed. The returned array contains components for who the release failed, for caller's convenience

func (*HSMv2) ReserveComponents

func (b *HSMv2) ReserveComponents(compList []ReservationData) ([]*ReservationData, error)

Check each component in the given list. If it already has a reservation key, try to reacquire the reservation so the auto-renew thread will have it. If it has a deputy key, make sure it's valid. Any component without keys or with invalid keys, acquire a reservation for that component. The return array contains only components for which we aquired a reservation, as a convenience to the caller so they don't have to create this list themselves.

type HsmData

type HsmData struct {
	BaseData base.Component `json:"baseData"`

	RfFQDN           string   `json:"RfFQDN"`
	PowerActionURI   string   `json:"actionURI"`
	AllowableActions []string `json:"allowableActions"`
	PowerStatusURI   string   `json:"statusURI"`
	Error            error    `json:"error"`

	// For PCS power capping
	PowerCapURI           string              `json:"powerCapURI"`
	PowerCapTargetURI     string              `json:"powerCapTargetURI"`
	PowerCapControlsCount int                 `json:"powerCapControlsCount"`
	PowerCapCtlInfoCount  int                 `json:"powerCapCtlInfoCount"`
	PowerCaps             map[string]PowerCap `json:"powerCaps"`

	// For PCS transitions
	PoweredBy []string
}

type PowerCap

type PowerCap struct {
	Name        string
	Path        string
	Min         int
	Max         int
	PwrCtlIndex int
}

PowerCap defines values useful to PCS for power capping.

type ReservationData

type ReservationData struct {
	XName            string
	ReservationOwner bool   //true == we got the rsv, not just using deputy key
	ReservationKey   string //only valid if we had to get the reservation
	ExpirationTime   string //Ditto.
	DeputyKey        string //Can be empty, filled in when getting reservation
	Error            error
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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