1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
package ipmi
import (
"context"
"fmt"
)
func (c *Client) SetBootParamSetInProgress(ctx context.Context, setInProgress SetInProgressState) error {
param := &BootOptionParam_SetInProgress{
Value: setInProgress,
}
if err := c.SetSystemBootOptionsParamFor(ctx, param); err != nil {
return fmt.Errorf("SetSystemBootOptionsFor failed, err: %w", err)
}
return nil
}
func (c *Client) SetBootParamBootFlags(ctx context.Context, bootFlags *BootOptionParam_BootFlags) error {
if err := c.SetBootParamSetInProgress(ctx, SetInProgress_SetInProgress); err != nil {
goto OUT
} else {
if err := c.SetSystemBootOptionsParamFor(ctx, bootFlags); err != nil {
return fmt.Errorf("SetSystemBootOptions failed, err: %w", err)
}
}
OUT:
if err := c.SetBootParamSetInProgress(ctx, SetInProgress_SetComplete); err != nil {
return fmt.Errorf("SetBootParamSetInProgress failed, err: %w", err)
}
return nil
}
func (c *Client) SetBootParamClearAck(ctx context.Context, by BootInfoAcknowledgeBy) error {
param := &BootOptionParam_BootInfoAcknowledge{}
switch by {
case BootInfoAcknowledgeByBIOSPOST:
param.ByBIOSPOST = true
case BootInfoAcknowledgeByOSLoader:
param.ByOSLoader = true
case BootInfoAcknowledgeByOSServicePartition:
param.ByOSServicePartition = true
case BootInfoAcknowledgeBySMS:
param.BySMS = true
case BootInfoAcknowledgeByOEM:
param.ByOEM = true
}
if err := c.SetSystemBootOptionsParamFor(ctx, param); err != nil {
return fmt.Errorf("SetSystemBootOptionsFor failed, err: %w", err)
}
return nil
}
// SetBootDevice set the boot device for next boot.
// persist of false means it applies to next boot only.
// persist of true means this setting is persistent for all future boots.
func (c *Client) SetBootDevice(ctx context.Context, bootDeviceSelector BootDeviceSelector, bootType BIOSBootType, persist bool) error {
param := &BootOptionParam_BootFlags{
BootFlagsValid: true,
Persist: persist,
BIOSBootType: bootType,
BootDeviceSelector: bootDeviceSelector,
}
if err := c.SetSystemBootOptionsParamFor(ctx, param); err != nil {
return fmt.Errorf("SetSystemBootOptions failed, err: %w", err)
}
return nil
}
|