Skip to content

Commit 7a80936

Browse files
Add reset bmc, improve controller logic
1 parent fe150a6 commit 7a80936

File tree

13 files changed

+419
-373
lines changed

13 files changed

+419
-373
lines changed

api/v1alpha1/bmc_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const (
2323
// BMCSpec defines the desired state of BMC
2424
// +kubebuilder:validation:XValidation:rule="has(self.access) != has(self.endpointRef)",message="exactly one of access or endpointRef needs to be set"
2525
type BMCSpec struct {
26+
27+
//UUID is the unique identifier for the BMC as defined in REDFISH API.
28+
UUID string `json:"uuid,omitempty"`
29+
2630
// EndpointRef is a reference to the Kubernetes object that contains the endpoint information for the BMC.
2731
// This reference is typically used to locate the BMC endpoint within the cluster.
2832
// +optional

api/v1alpha1/bmcsettings_types.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,10 @@ const (
5757
BMCSettingsStateFailed BMCSettingsState = "Failed"
5858
)
5959

60-
type BMCSettingUpdateState string
61-
62-
const (
63-
// SettingUpdateStateWaitOnServerReboot specifies that the BMC setting state is waiting on server to turn off during Reboot.
64-
BMCSettingUpdateWaitOnServerRebootPowerOff BMCSettingUpdateState = "WaitOnServerRebootPowerOff"
65-
// BMCSettingUpdateWaitOnServerRebootPowerOn specifies that the BMC setting state is waiting on server to turn on during Reboot.
66-
BMCSettingUpdateWaitOnServerRebootPowerOn BMCSettingUpdateState = "WaitOnServerRebootPowerOn"
67-
// SettingUpdateStateIssued specifies that the BMC new setting was posted to RedFish
68-
BMCSettingUpdateStateIssue BMCSettingUpdateState = "IssueSettingUpdate"
69-
// SettingUpdateStateCompleted specifies that the BMC setting has been completed.
70-
BMCSettingUpdateStateVerification BMCSettingUpdateState = "VerifySettingUpdate"
71-
)
72-
7360
// BMCSettingsStatus defines the observed state of BMCSettings.
7461
type BMCSettingsStatus struct {
7562
// State represents the current state of the BMC configuration task.
7663
State BMCSettingsState `json:"state,omitempty"`
77-
// UpdateSettingState represents the current state of the BMC setting update task.
78-
UpdateSettingState BMCSettingUpdateState `json:"updateSettingState,omitempty"`
7964
}
8065

8166
// +kubebuilder:object:root=true

bmc/bmc.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,32 @@ type BMC interface {
4242
GetSystems(ctx context.Context) ([]Server, error)
4343

4444
// GetManager returns the manager
45-
GetManager() (*Manager, error)
45+
GetManager(UUID string) (*redfish.Manager, error)
46+
47+
// Reset performs a reset on the Manager.
48+
ResetManager(ctx context.Context, UUID string, resetType redfish.ResetType) error
4649

4750
GetBootOrder(ctx context.Context, systemUUID string) ([]string, error)
4851

4952
GetBiosAttributeValues(ctx context.Context, systemUUID string, attributes []string) (redfish.SettingsAttributes, error)
5053

51-
GetBMCAttributeValues(ctx context.Context, attributes []string) (redfish.SettingsAttributes, error)
54+
//(ctx context.Context, systemUUID string) (redfish.SettingsAttributes, error)
55+
56+
GetBMCAttributeValues(ctx context.Context, UUID string, attributes []string) (redfish.SettingsAttributes, error)
57+
58+
GetBMCPendingAttributeValues(ctx context.Context, UUID string) (redfish.SettingsAttributes, error)
5259

5360
CheckBiosAttributes(attrs map[string]string) (reset bool, err error)
5461

5562
CheckBMCAttributes(attrs redfish.SettingsAttributes) (reset bool, err error)
5663

5764
SetBiosAttributesOnReset(ctx context.Context, systemUUID string, attributes map[string]string) (err error)
5865

59-
SetBMCAttributesImediately(ctx context.Context, attributes redfish.SettingsAttributes) (err error)
66+
SetBMCAttributesImediately(ctx context.Context, UUID string, attributes redfish.SettingsAttributes) (err error)
6067

6168
GetBiosVersion(ctx context.Context, systemUUID string) (string, error)
6269

63-
GetBMCVersion(ctx context.Context) (string, error)
70+
GetBMCVersion(ctx context.Context, UUID string) (string, error)
6471

6572
SetBootOrder(ctx context.Context, systemUUID string, order []string) error
6673

0 commit comments

Comments
 (0)