Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose BIOS configuration in Server type #89

Merged
merged 10 commits into from
Aug 5, 2024
Merged
25 changes: 25 additions & 0 deletions api/v1alpha1/server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ type BMCAccess struct {
BMCSecretRef v1.LocalObjectReference `json:"bmcSecretRef"`
}

// BootOrder represents the boot order of the server.
type BootOrder struct {
// Name is the name of the boot device.
Name string `json:"name"`
// Priority is the priority of the boot device.
Priority int `json:"priority"`
// Device is the device to boot from.
Device string `json:"device"`
}

// BIOSSettings represents the BIOS settings for a server.
type BIOSSettings struct {
// Version specifies the version of the server BIOS for which the settings are defined.
Version string `json:"version"`
// Settings is a map of key-value pairs representing the BIOS settings.
Settings map[string]string `json:"settings,omitempty"`
}

// ServerSpec defines the desired state of a Server.
type ServerSpec struct {
// UUID is the unique identifier for the server.
Expand Down Expand Up @@ -82,6 +100,11 @@ type ServerSpec struct {
// the boot configuration for this server. This field is optional and can be omitted
// if no boot configuration is specified.
BootConfigurationRef *v1.ObjectReference `json:"bootConfigurationRef,omitempty"`

// BootOrder specifies the boot order of the server.
BootOrder []BootOrder `json:"bootOrder,omitempty"`
// BIOS specifies the BIOS settings for the server.
BIOS []BIOSSettings `json:"BIOS,omitempty"`
}

// ServerState defines the possible states of a server.
Expand Down Expand Up @@ -139,6 +162,8 @@ type ServerStatus struct {
// NetworkInterfaces is a list of network interfaces associated with the server.
NetworkInterfaces []NetworkInterface `json:"networkInterfaces,omitempty"`

BIOS BIOSSettings `json:"BIOS,omitempty"`
afritzler marked this conversation as resolved.
Show resolved Hide resolved

// Conditions represents the latest available observations of the server's current state.
// +patchStrategy=merge
// +patchMergeKey=type
Expand Down
50 changes: 50 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 55 additions & 2 deletions bmc/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type BMC interface {
Reset() error

// SetPXEBootOnce sets the boot device for the next system boot.
SetPXEBootOnce(systemID string) error
SetPXEBootOnce(systemUUID string) error

// GetSystemInfo retrieves information about the system.
GetSystemInfo(systemID string) (SystemInfo, error)
GetSystemInfo(systemUUID string) (SystemInfo, error)

// Logout closes the BMC client connection by logging out
Logout()
Expand All @@ -33,6 +33,59 @@ type BMC interface {

// GetManager returns the manager
GetManager() (*Manager, error)

GetBootOrder(systemUUID string) ([]string, error)

GetBiosAttributeValues(systemUUID string, attributes []string) (map[string]string, error)

SetBiosAttributes(systemUUID string, attributes map[string]string) (reset bool, err error)

GetBiosVersion(systemUUID string) (string, error)

SetBootOrder(systemUUID string, order []string) error
}

type Bios struct {
Version string
Attributes map[string]string
}

type RegistryEntryAttributes struct {
AttributeName string
CurrentValue interface{}
DisplayName string
DisplayOrder int
HelpText string
Hidden bool
Immutable bool
MaxLength int
MenuPath string
MinLength int
ReadOnly bool
ResetRequired bool
Type string
WriteOnly bool
}

type RegistryEntry struct {
Attributes []RegistryEntryAttributes
}

// BiosRegistry describes the Message Registry file locator Resource.
type BiosRegistry struct {
common.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// Description provides a description of this resource.
Description string
// Languages is the RFC5646-conformant language codes for the
// available Message Registries.
Languages []string
// Registry shall contain the Message Registry name and it major and
// minor versions, as defined by the Redfish Specification.
RegistryEntries RegistryEntry
}

type NetworkInterface struct {
Expand Down
Loading