bmc

package
v2.2.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBootDeviceOverrideFromInterface added in v2.2.0

func GetBootDeviceOverrideFromInterface(
	ctx context.Context,
	timeout time.Duration,
	providers []interface{},
) (override BootDeviceOverride, metadata Metadata, err error)

GetBootDeviceOverrideFromInterface will get boot device override settings from the first successful call to a BootDeviceOverrideGetter in the array of providers.

func GetSystemEventLogFromInterfaces added in v2.2.0

func GetSystemEventLogFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (sel SystemEventLogEntries, metadata Metadata, err error)

Types

type BMCResetter

type BMCResetter interface {
	BmcReset(ctx context.Context, resetType string) (ok bool, err error)
}

BMCResetter for resetting a BMC. resetType: "warm" resets the management console without rebooting the BMC resetType: "cold" reboots the BMC

type BiosConfigurationGetter

type BiosConfigurationGetter interface {
	GetBiosConfiguration(ctx context.Context) (biosConfig map[string]string, err error)
}

type BiosConfigurationResetter added in v2.2.4

type BiosConfigurationResetter interface {
	ResetBiosConfiguration(ctx context.Context) (err error)
}

type BiosConfigurationSetter added in v2.2.4

type BiosConfigurationSetter interface {
	SetBiosConfiguration(ctx context.Context, biosConfig map[string]string) (err error)
}

type BootDeviceOverride added in v2.2.0

type BootDeviceOverride struct {
	IsPersistent bool
	IsEFIBoot    bool
	Device       BootDeviceType
}

type BootDeviceOverrideGetter added in v2.2.0

type BootDeviceOverrideGetter interface {
	BootDeviceOverrideGet(ctx context.Context) (override BootDeviceOverride, err error)
}

BootDeviceOverrideGetter gets boot override settings for a machine

type BootDeviceSetter

type BootDeviceSetter interface {
	BootDeviceSet(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)
}

BootDeviceSetter sets the next boot device for a machine

type BootDeviceType added in v2.2.0

type BootDeviceType string
const (
	BootDeviceTypeBIOS        BootDeviceType = "bios"
	BootDeviceTypeCDROM       BootDeviceType = "cdrom"
	BootDeviceTypeDiag        BootDeviceType = "diag"
	BootDeviceTypeFloppy      BootDeviceType = "floppy"
	BootDeviceTypeDisk        BootDeviceType = "disk"
	BootDeviceTypeNone        BootDeviceType = "none"
	BootDeviceTypePXE         BootDeviceType = "pxe"
	BootDeviceTypeRemoteDrive BootDeviceType = "remote_drive"
	BootDeviceTypeSDCard      BootDeviceType = "sd_card"
	BootDeviceTypeUSB         BootDeviceType = "usb"
	BootDeviceTypeUtil        BootDeviceType = "utilities"
)

type Closer

type Closer interface {
	Close(ctx context.Context) error
}

Closer interface for closing a connection to a BMC

type FirmwareInstallProvider added in v2.2.0

type FirmwareInstallProvider interface {
	// FirmwareInstallUploadAndInitiate uploads _and_ initiates the firmware install process.
	//
	// return values:
	// taskID - A taskID is returned if the update process on the BMC returns an identifier for the update process.
	FirmwareInstallUploadAndInitiate(ctx context.Context, component string, file *os.File) (taskID string, err error)
}

FirmwareInstallProvider defines an interface to upload and initiate a firmware install in the same implementation method

Its intended to deprecate the FirmwareInstall interface

type FirmwareInstallStepsGetter added in v2.2.0

type FirmwareInstallStepsGetter interface {
	FirmwareInstallSteps(ctx context.Context, component string) ([]constants.FirmwareInstallStep, error)
}

type FirmwareInstallVerifier

type FirmwareInstallVerifier interface {
	// FirmwareInstallStatus returns the status of the firmware install process.
	//
	// parameters:
	// installVersion (required) - the version this method should check is installed.
	// component (optional) - the component slug for the component update being installed.
	// taskID (optional) - the task identifier.
	//
	// return values:
	// status - returns one of the FirmwareInstall statuses (see devices/constants.go).
	FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)
}

Note: this interface is to be deprecated in favour of a more generic FirmwareTaskVerifier.

FirmwareInstallVerifier defines an interface to check firmware install status

type FirmwareInstaller

type FirmwareInstaller interface {
	// FirmwareInstall uploads firmware update payload to the BMC returning the task ID
	//
	// parameters:
	// component - the component slug for the component update being installed.
	// operationsApplyTime - one of the OperationApplyTime constants
	// forceInstall - purge the install task queued/scheduled firmware install BMC task (if any).
	// reader - the io.reader to the firmware update file.
	//
	// return values:
	// taskID - A taskID is returned if the update process on the BMC returns an identifier for the update process.
	FirmwareInstall(ctx context.Context, component string, operationApplyTime string, forceInstall bool, reader io.Reader) (taskID string, err error)
}

FirmwareInstaller defines an interface to upload and initiate a firmware install

type FirmwareInstallerUploaded added in v2.2.0

type FirmwareInstallerUploaded interface {
	// FirmwareInstallUploaded uploads firmware update payload to the BMC returning the firmware install task ID
	//
	// parameters:
	// component - the component slug for the component update being installed.
	// uploadTaskID - the taskID for the firmware upload verify task (returned by FirmwareUpload)
	//
	// return values:
	// installTaskID - A installTaskID is returned if the update process on the BMC returns an identifier for the firmware install process.
	FirmwareInstallUploaded(ctx context.Context, component, uploadTaskID string) (taskID string, err error)
}

FirmwareInstallerUploaded defines an interface to install firmware that was previously uploaded with FirmwareUpload

type FirmwareTaskVerifier added in v2.2.0

type FirmwareTaskVerifier interface {
	// FirmwareTaskStatus returns the status of the firmware upload process.
	//
	// parameters:
	// kind (required) - The FirmwareInstallStep
	// component (optional) - the component slug for the component that the firmware was uploaded for.
	// taskID (required) - the task identifier.
	// installVersion (optional) -  the firmware version being installed as part of the task if applicable.
	//
	// return values:
	// state - returns one of the FirmwareTask statuses (see devices/constants.go).
	// status - returns firmware task progress or other arbitrary task information.
	FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string) (state constants.TaskState, status string, err error)
}

FirmwareTaskVerifier defines an interface to check the status for firmware related tasks queued on the BMC. these could be a an firmware upload and verify task or a firmware install task.

This is to replace the FirmwareInstallVerifier interface

type FirmwareUploader added in v2.2.0

type FirmwareUploader interface {
	FirmwareUpload(ctx context.Context, component string, file *os.File) (uploadVerifyTaskID string, err error)
}

type FloppyImageMounter added in v2.2.0

type FloppyImageMounter interface {
	MountFloppyImage(ctx context.Context, image io.Reader) (err error)
}

FloppyImageMounter defines methods to upload a floppy image

type FloppyImageUnmounter added in v2.2.0

type FloppyImageUnmounter interface {
	UnmountFloppyImage(ctx context.Context) (err error)
}

FloppyImageMounter defines methods to unmount a floppy image

type InventoryGetter

type InventoryGetter interface {
	Inventory(ctx context.Context) (device *common.Device, err error)
}

InventoryGetter defines methods to retrieve device hardware and firmware inventory

type Metadata

type Metadata struct {
	// SuccessfulProvider is the name of the provider that successfully executed
	SuccessfulProvider string
	// ProvidersAttempted is a slice of all providers that were attempt to execute
	ProvidersAttempted []string
	// SuccessfulOpenConns is a slice of provider names that were opened successfully
	SuccessfulOpenConns []string
	// SuccessfulCloseConns is a slice of provider names that were closed successfully
	SuccessfulCloseConns []string
	// FailedProviderDetail holds the failed providers error messages for called methods
	FailedProviderDetail map[string]string
}

Metadata represents details about a bmc method

func ClearSystemEventLogFromInterfaces

func ClearSystemEventLogFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (metadata Metadata, err error)

func CloseConnectionFromInterfaces

func CloseConnectionFromInterfaces(ctx context.Context, generic []interface{}) (metadata Metadata, err error)

CloseConnectionFromInterfaces identifies implementations of the Closer() interface and and passes the found implementations to the closeConnection() wrapper

func CreateUserFromInterfaces

func CreateUserFromInterfaces(ctx context.Context, timeout time.Duration, user, pass, role string, generic []interface{}) (ok bool, metadata Metadata, err error)

CreateUsersFromInterfaces identifies implementations of the UserCreator interface and passes them to the createUser() wrapper method.

func DeactivateSOLFromInterfaces added in v2.2.1

func DeactivateSOLFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (metadata Metadata, err error)

DeactivateSOLFromInterfaces identifies implementations of the SOLDeactivator interface and passes them to the deactivateSOL() wrapper method.

func DeleteUserFromInterfaces

func DeleteUserFromInterfaces(ctx context.Context, timeout time.Duration, user string, generic []interface{}) (ok bool, metadata Metadata, err error)

DeleteUsersFromInterfaces identifies implementations of the UserDeleter interface and passes them to the deleteUser() wrapper method.

func FirmwareInstallFromInterfaces

func FirmwareInstallFromInterfaces(ctx context.Context, component, operationApplyTime string, forceInstall bool, reader io.Reader, generic []interface{}) (taskID string, metadata Metadata, err error)

FirmwareInstallFromInterfaces identifies implementations of the FirmwareInstaller interface and passes the found implementations to the firmwareInstall() wrapper

func FirmwareInstallStatusFromInterfaces

func FirmwareInstallStatusFromInterfaces(ctx context.Context, installVersion, component, taskID string, generic []interface{}) (status string, metadata Metadata, err error)

FirmwareInstallStatusFromInterfaces identifies implementations of the FirmwareInstallVerifier interface and passes the found implementations to the firmwareInstallStatus() wrapper.

func FirmwareInstallStepsFromInterfaces added in v2.2.0

func FirmwareInstallStepsFromInterfaces(ctx context.Context, component string, generic []interface{}) (steps []constants.FirmwareInstallStep, metadata Metadata, err error)

FirmwareInstallStepsFromInterfaces identifies implementations of the FirmwareInstallStepsGetter interface and passes the found implementations to the firmwareInstallSteps() wrapper.

func FirmwareInstallUploadAndInitiateFromInterfaces added in v2.2.0

func FirmwareInstallUploadAndInitiateFromInterfaces(ctx context.Context, component string, file *os.File, generic []interface{}) (taskID string, metadata Metadata, err error)

FirmwareInstallUploadAndInitiateFromInterfaces identifies implementations of the FirmwareInstallProvider interface and passes the found implementations to the firmwareInstallUploadAndInitiate() wrapper

func FirmwareInstallerUploadedFromInterfaces added in v2.2.0

func FirmwareInstallerUploadedFromInterfaces(ctx context.Context, component, uploadTaskID string, generic []interface{}) (installTaskID string, metadata Metadata, err error)

FirmwareInstallerUploadedFromInterfaces identifies implementations of the FirmwareInstallUploaded interface and passes the found implementations to the firmwareInstallUploaded() wrapper

func FirmwareTaskStatusFromInterfaces added in v2.2.0

func FirmwareTaskStatusFromInterfaces(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string, generic []interface{}) (state constants.TaskState, status string, metadata Metadata, err error)

FirmwareTaskStatusFromInterfaces identifies implementations of the FirmwareTaskVerifier interface and passes the found implementations to the firmwareTaskStatus() wrapper.

func FirmwareUploadFromInterfaces added in v2.2.0

func FirmwareUploadFromInterfaces(ctx context.Context, component string, file *os.File, generic []interface{}) (taskID string, metadata Metadata, err error)

FirmwareUploaderFromInterfaces identifies implementations of the FirmwareUploader interface and passes the found implementations to the firmwareUpload() wrapper.

func GetBiosConfigurationInterfaces

func GetBiosConfigurationInterfaces(ctx context.Context, generic []interface{}) (biosConfig map[string]string, metadata Metadata, err error)

func GetInventoryFromInterfaces

func GetInventoryFromInterfaces(ctx context.Context, generic []interface{}) (device *common.Device, metadata Metadata, err error)

GetInventoryFromInterfaces identifies implementations of the InventoryGetter interface and passes the found implementations to the inventory() wrapper method

func GetPostCodeInterfaces

func GetPostCodeInterfaces(ctx context.Context, generic []interface{}) (status string, code int, metadata Metadata, err error)

GetPostCodeFromInterfaces identifies implementations of the PostCodeGetter interface and passes the found implementations to the postCode() wrapper method.

func GetPowerStateFromInterfaces

func GetPowerStateFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (state string, metadata Metadata, err error)

GetPowerStateFromInterfaces identifies implementations of the PostStateGetter interface and passes the found implementations to the getPowerState() wrapper.

func GetSystemEventLogRawFromInterfaces added in v2.2.0

func GetSystemEventLogRawFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (eventlog string, metadata Metadata, err error)

func MountFloppyImageFromInterfaces added in v2.2.0

func MountFloppyImageFromInterfaces(ctx context.Context, image io.Reader, p []interface{}) (metadata Metadata, err error)

MountFloppyImageFromInterfaces identifies implementations of the FloppyImageMounter interface and passes the found implementations to the mountFloppyImage() wrapper

func OpenConnectionFromInterfaces

func OpenConnectionFromInterfaces(ctx context.Context, timeout time.Duration, providers []interface{}) (opened []interface{}, metadata Metadata, err error)

OpenConnectionFromInterfaces will try all opener interfaces and remove failed ones. The reason failed ones need to be removed is so that when other methods are called (like powerstate) implementations that have connections wont nil pointer error when their connection fails.

func ReadUsersFromInterfaces

func ReadUsersFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (users []map[string]string, metadata Metadata, err error)

ReadUsersFromInterfaces identifies implementations of the UserReader interface and passes them to the readUsers() wrapper method.

func ResetBMCFromInterfaces

func ResetBMCFromInterfaces(ctx context.Context, timeout time.Duration, resetType string, generic []interface{}) (ok bool, metadata Metadata, err error)

ResetBMCFromInterfaces identifies implementations of the BMCResetter interface and passes them to the resetBMC() wrapper method.

func ResetBiosConfigurationInterfaces added in v2.2.4

func ResetBiosConfigurationInterfaces(ctx context.Context, generic []interface{}) (metadata Metadata, err error)

func ScreenshotFromInterfaces

func ScreenshotFromInterfaces(ctx context.Context, generic []interface{}) (image []byte, fileType string, metadata Metadata, err error)

ScreenshotFromInterfaces identifies implementations of the ScreenshotGetter interface and passes the found implementations to the screenshot() wrapper method.

func SendNMIFromInterface added in v2.2.3

func SendNMIFromInterface(
	ctx context.Context,
	timeout time.Duration,
	providers []interface{},
) (metadata Metadata, err error)

SendNMIFromInterface will look for providers that implement NMISender and attempt to call SendNMI until a provider is successful, or all providers have been exhausted.

func SetBiosConfigurationInterfaces added in v2.2.4

func SetBiosConfigurationInterfaces(ctx context.Context, generic []interface{}, biosConfig map[string]string) (metadata Metadata, err error)

func SetBootDeviceFromInterfaces

func SetBootDeviceFromInterfaces(ctx context.Context, timeout time.Duration, bootDevice string, setPersistent, efiBoot bool, generic []interface{}) (ok bool, metadata Metadata, err error)

SetBootDeviceFromInterfaces identifies implementations of the BootDeviceSetter interface and passes the found implementations to the setBootDevice() wrapper

func SetPowerStateFromInterfaces

func SetPowerStateFromInterfaces(ctx context.Context, timeout time.Duration, state string, generic []interface{}) (ok bool, metadata Metadata, err error)

SetPowerStateFromInterfaces identifies implementations of the PostStateSetter interface and passes the found implementations to the setPowerState() wrapper.

func SetVirtualMediaFromInterfaces

func SetVirtualMediaFromInterfaces(ctx context.Context, kind string, mediaURL string, generic []interface{}) (ok bool, metadata Metadata, err error)

SetVirtualMediaFromInterfaces identifies implementations of the virtualMediaSetter interface and passes the found implementations to the setVirtualMedia() wrapper

func UnmountFloppyImageFromInterfaces added in v2.2.0

func UnmountFloppyImageFromInterfaces(ctx context.Context, p []interface{}) (metadata Metadata, err error)

MountFloppyImageFromInterfaces identifies implementations of the FloppyImageUnmounter interface and passes the found implementations to the unmountFloppyImage() wrapper

func UpdateUserFromInterfaces

func UpdateUserFromInterfaces(ctx context.Context, timeout time.Duration, user, pass, role string, generic []interface{}) (ok bool, metadata Metadata, err error)

UpdateUsersFromInterfaces identifies implementations of the UserUpdater interface and passes them to the updateUser() wrapper method.

func (*Metadata) RegisterSpanAttributes added in v2.2.0

func (m *Metadata) RegisterSpanAttributes(host string, span trace.Span)

type NMISender added in v2.2.3

type NMISender interface {
	SendNMI(ctx context.Context) error
}

type Opener

type Opener interface {
	Open(ctx context.Context) error
}

Opener interface for opening a connection to a BMC

type PostCodeGetter

type PostCodeGetter interface {
	// PostCode retrieves the BIOS/UEFI POST code from a device
	//
	// returns 'status' which is a (bmclib specific) string identifier for the POST code
	// and 'code' with the actual POST code returned to bmclib by the device
	PostCode(ctx context.Context) (status string, code int, err error)
}

PostCodeGetter defines methods to retrieve device BIOS/UEFI POST code

type PowerSetter

type PowerSetter interface {
	// PowerSet sets the power state of a Machine through a BMC.
	// While the state's accepted are ultimately up to what the implementation
	// expects, implementations should generally try to provide support for the following
	// states, modeled after the functionality available in `ipmitool chassis power`.
	//
	// "on": Power up chassis. should not error if the machine is already on
	// "off": Hard powers down chassis. should not error if the machine is already off
	// "soft": Initiate a soft-shutdown of OS via ACPI.
	// "reset": soft down and then power on. simulates a reboot from the host OS.
	// "cycle": hard power down followed by a power on. simulates pressing a power button
	// to turn the machine off then pressing the button again to turn it on.
	PowerSet(ctx context.Context, state string) (ok bool, err error)
}

PowerSetter sets the power state of a BMC

type PowerStateGetter

type PowerStateGetter interface {
	PowerStateGet(ctx context.Context) (state string, err error)
}

PowerStateGetter gets the power state of a BMC

type Provider

type Provider interface {
	// Name of the provider
	Name() string
}

Provider interface describes details about a provider

type SOLDeactivator added in v2.2.1

type SOLDeactivator interface {
	DeactivateSOL(ctx context.Context) (err error)
}

SOLDeactivator for deactivating SOL sessions on a BMC.

type ScreenshotGetter

type ScreenshotGetter interface {
	Screenshot(ctx context.Context) (image []byte, fileType string, err error)
}

ScreenshotGetter interface provides methods to query for a BMC screen capture.

type SystemEventLog

type SystemEventLog interface {
	ClearSystemEventLog(ctx context.Context) (err error)
	GetSystemEventLog(ctx context.Context) (entries [][]string, err error)
	GetSystemEventLogRaw(ctx context.Context) (eventlog string, err error)
}

System Event Log Services for related services

type SystemEventLogEntries added in v2.2.0

type SystemEventLogEntries [][]string

type UserCreator

type UserCreator interface {
	UserCreate(ctx context.Context, user, pass, role string) (ok bool, err error)
}

UserCreator creates a user on a BMC

type UserDeleter

type UserDeleter interface {
	UserDelete(ctx context.Context, user string) (ok bool, err error)
}

UserDeleter deletes a user on a BMC

type UserReader

type UserReader interface {
	UserRead(ctx context.Context) (users []map[string]string, err error)
}

UserReader lists all users on a BMC

type UserUpdater

type UserUpdater interface {
	UserUpdate(ctx context.Context, user, pass, role string) (ok bool, err error)
}

UserUpdater updates a user on a BMC

type VirtualMediaSetter

type VirtualMediaSetter interface {
	SetVirtualMedia(ctx context.Context, kind string, mediaURL string) (ok bool, err error)
}

VirtualMediaSetter controls the virtual media attached to a machine

Jump to

Keyboard shortcuts

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