Documentation ¶
Index ¶
- Constants
- Variables
- func ConditionKinds() []rctypes.Kind
- func CopyAsGenericTask(task *Task) (*rctypes.Task[any, any], error)
- func SingularComponent(slug string) bool
- type Action
- type Actions
- type AppKind
- type ComponentConverter
- type FirmwarePlanMethod
- type InstallMethod
- type LogLevel
- type RunMode
- type Step
- type StepGroup
- type StepHandler
- type StepName
- type Steps
- type StoreKind
- type Task
- type TaskData
Constants ¶
const ( AppName = "agent" AppKindService AppKind = "service" AppKindCLI AppKind = "cli" RunInband RunMode = "inband" RunOutofband RunMode = "outofband" InventoryStoreYAML StoreKind = "yaml" InventoryStoreServerservice StoreKind = "serverservice" LogLevelInfo LogLevel = "info" LogLevelDebug LogLevel = "debug" LogLevelTrace LogLevel = "trace" )
const ( // InstallMethodOutofband indicates the out of band firmware install method. InstallMethodOutofband InstallMethod = "outofband" InstallMethodInband InstallMethod = "inband" // FromFirmwareSet is a TaskParameter attribute that declares the // the firmware versions to be installed are to be planned from the given firmware set ID. FromFirmwareSet FirmwarePlanMethod = "fromFirmwareSet" // FromRequestedFirmware is a TaskParameter attribute that declares the // firmware versions to be installed have been defined as part of the request, // and so no further firmware planning is required. FromRequestedFirmware FirmwarePlanMethod = "fromRequestedFirmware" // task states // // states the task state machine transitions through StatePending = rctypes.Pending StateActive = rctypes.Active StateSucceeded = rctypes.Succeeded StateFailed = rctypes.Failed TaskDataStructVersion = "1.0" )
const (
// Each action may be tried upto these many times.
ActionMaxAttempts = 3
)
const (
// Each action may be tried upto these many times.
StepMaxAttempts = 2
)
Variables ¶
var ( ErrInstalledFirmwareEqual = errors.New("installed and expected firmware are equal, no action necessary") ErrHostPowerCycleRequired = errors.New("host powercycle required") )
var ( // ErrComponentConverter is returned when an error occurs in the component data conversion. ErrComponentConverter = errors.New("error in component converter") )
var (
ErrInitTask = errors.New("error initializing new task from condition")
)
var ( // FirmwareInstallOrder defines the order in which firmware is installed. // // TODO(joel): fix up bmc-toolbox/common slugs to be of lower case instead of upper // nolint:gomnd // component install order number is clear as is. FirmwareInstallOrder = map[string]int{ strings.ToLower(common.SlugBMC): 0, strings.ToLower(common.SlugBIOS): 1, strings.ToLower(common.SlugCPLD): 2, strings.ToLower(common.SlugDrive): 3, strings.ToLower(common.SlugBackplaneExpander): 4, strings.ToLower(common.SlugStorageController): 5, strings.ToLower(common.SlugNIC): 6, strings.ToLower(common.SlugPSU): 7, strings.ToLower(common.SlugTPM): 8, strings.ToLower(common.SlugGPU): 9, strings.ToLower(common.SlugCPU): 10, } )
Functions ¶
func ConditionKinds ¶
Returns the Conditions supported by this agent
func SingularComponent ¶
These components are in most cases are present in a single package and from one vendor in a server, in comparison to drives, nics, raid controllers which could be in multiples and from different vendors for these 'singular' components we don't require to compare the exact model number for a firmware install.
Types ¶
type Action ¶
type Action struct { // ID is a unique identifier for this action ID string `json:"id"` // The parent task identifier TaskID string `json:"task_id"` // BMCTaskID is the task identifier to track a BMC job // these are returned when the firmware is uploaded and is being verified // or an install was initiated on the BMC . BMCTaskID string `json:"bmc_task_id,omitempty"` // Set to the component identified as the target of the firmware install Component *rtypes.Component `json:"component"` // Method of install InstallMethod InstallMethod `json:"install_method"` // status indicates the action state State rctypes.State `json:"state"` // Firmware to be installed, this is set in the Task Plan phase. Firmware rctypes.Firmware `json:"firmware"` // In the remote inband case a list of firmwares will be delegated for install Firmwares []rctypes.Firmware `json:"firmwares"` FirmwareInstallStep string `json:"firmware_install_step"` // FirmwareTempFile is the temporary file downloaded to be installed. // // This is declared once the firmware file has been downloaded for install. FirmwareTempFile string `json:"firmware_temp_file"` // ForceInstall will cause the action to skip checking the currently installed component firmware ForceInstall bool `json:"verify_current_firmware"` // BMC reset required before install BMCResetPreInstall bool `json:"bmc_reset_pre_install"` // BMC reset required after install BMCResetPostInstall bool `json:"bmc_reset_post_install"` // BMC reset required on install failure BMCResetOnInstallFailure bool `json:"bmc_reset_on_install_failure"` // HostPowerCycled is set when the host has been power cycled for the action. HostPowerCycled bool `json:"host_power_cycled"` // HostPowerCycleInitiated indicates when a power cycle has been initated for the host. HostPowerCycleInitiated bool `json:"host_power_cycle_initiated"` // HostPowerOffInitiated indicates a power off was initated on the host. HostPowerOffInitiated bool `json:"host_power_off_initiated"` // HostPowerOffPreInstall is set when the firmware install provider indicates // the host must be powered off before proceeding with the install step. HostPowerOffPreInstall bool `json:"host_power_off_pre_install"` // First is set to true when its the first action being executed First bool `json:"first"` // Last is set to true when its the last action being executed Last bool `json:"last"` // Attempts indicates how many times this action has been tried Attempts int `json:"attempts"` // Steps identify the smallest unit of work executed by an action Steps Steps `json:"steps"` }
Action holds attributes for each firmware to be installed
type Actions ¶
type Actions []*Action
Actions is a list of actions
type ComponentConverter ¶
type ComponentConverter struct {
// contains filtered or unexported fields
}
ComponentConvertor provides methods to convert a common.Device to its Component equivalents.
func NewComponentConverter ¶
func NewComponentConverter() *ComponentConverter
NewComponentConverter returns a new ComponentConvertor
func (*ComponentConverter) CommonDeviceToComponents ¶
func (cc *ComponentConverter) CommonDeviceToComponents(device *common.Device) (rtypes.Components, error)
CommonDeviceToComponents converts a bmc-toolbox/common Device object to its agent Components type
TODO(joel): the bmc-toolbox/common Device component types could implement an interface with methods to retrieve component - firmware installed, vendor, model, serial, slug attributes this method can then call the interface methods instead of multiple small methods for each device component type.
type FirmwarePlanMethod ¶
type FirmwarePlanMethod string
FirmwarePlanMethod type defines the firmware resolution method by which the firmware to applied is planned.
type InstallMethod ¶
type InstallMethod string
InstallMethod is one of 'outofband' OR 'inband' it is the method by which the firmware is installed on the device.
type Step ¶
type Step struct { Name StepName `json:"name"` Handler StepHandler `json:"-"` Group StepGroup `json:"step_group"` PostStep StepHandler `json:"-"` Description string `json:"doc"` State rctypes.State `json:"state"` Status string `json:"status"` Attempts int `json:"attempts"` }
Step is the smallest unit of work within an Action
type StepHandler ¶
StepHandler defines the signature for each action unit to be executed
type Steps ¶
type Steps []*Step
Steps is the list of steps to be executed
type StoreKind ¶
type StoreKind string
func StoreKinds ¶
func StoreKinds() []StoreKind
StoreKinds returns the supported asset inventory, firmware configuration sources
type Task ¶
type Task rctypes.Task[*rctypes.FirmwareInstallTaskParameters, *TaskData]
Alias parameterized model.Task
func (*Task) MustMarshal ¶
func (t *Task) MustMarshal() json.RawMessage
type TaskData ¶
type TaskData struct { StructVersion string `json:"struct_version"` // This flag is set when a action requires a host power cycle. HostPowercycleRequired bool `json:"host_powercycle_required,omitempty"` // Agent determines the firmware to be installed for each component based on the firmware plan method. FirmwarePlanMethod FirmwarePlanMethod `json:"firmware_plan_method,omitempty"` // ActionsPlanned to be executed for each firmware to be installed. ActionsPlanned Actions `json:"actions_planned,omitempty"` // Scratch is an arbitrary key values map available to all task, action handler methods. Scratch map[string]string `json:"scratch,omitempty"` }