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

FS-1123: Supermicro (SMC) BIOS config Get, Set and Reset support via SUM #392

Merged
merged 16 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/go:1-1.21-bullseye
FROM mcr.microsoft.com/devcontainers/go:1-1.22-bullseye
RUN apt update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using a Microsoft golang container?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guess simply because that's what's suggested in the devcontainer documentation/examples. My understanding is there's nothing really special about the devcontainer image(s) so we could replace that with anything.

RUN apt install ipmitool -y

37 changes: 35 additions & 2 deletions examples/bios/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ func main() {
// Logger configuration
l := logrus.New()
l.Level = logrus.DebugLevel
// l.Level = logrus.TraceLevel
logger := logrusr.New(l)
logger.V(9)

// bmclib client abstraction
clientOpts := []bmclib.Option{bmclib.WithLogger(logger)}

client := bmclib.NewClient(*host, *user, *pass, clientOpts...)
client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetBiosConfiguration, providers.FeatureSetBiosConfiguration, providers.FeatureResetBiosConfiguration)
client.Registry.Drivers = client.Registry.Supports(
providers.FeatureGetBiosConfiguration,
providers.FeatureSetBiosConfiguration,
providers.FeatureResetBiosConfiguration,
providers.FeatureSetBiosConfigurationFromFile)

err := client.Open(ctx)
if err != nil {
Expand All @@ -57,7 +63,7 @@ func main() {
l.Fatal(err)
}

fmt.Printf("biosConfig: %+v\n", biosConfig)
fmt.Printf("biosConfig: %#v\n", biosConfig)
case "set":
exampleConfig := make(map[string]string)

Expand All @@ -82,6 +88,33 @@ func main() {
fmt.Println("Attempting to set BIOS configuration:")
fmt.Printf("exampleConfig: %+v\n", exampleConfig)

err := client.SetBiosConfiguration(ctx, exampleConfig)
if err != nil {
l.Error(err)
}
case "setfile":
exampleConfig := make(map[string]string)

if *dfile != "" {
cfgFile, err := os.Open(*dfile)
if err != nil {
l.Fatal(err)
}

defer cfgFile.Close()

jsonData, _ := io.ReadAll(cfgFile)
err = json.Unmarshal(jsonData, &exampleConfig)
if err != nil {
l.Error(err)
}
} else {
exampleConfig["TpmSecurity"] = "Off"
}

fmt.Println("Attempting to set BIOS configuration:")
fmt.Printf("exampleConfig: %+v\n", exampleConfig)

err := client.SetBiosConfiguration(ctx, exampleConfig)
if err != nil {
l.Error(err)
Expand Down
11 changes: 11 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
.................


Note: No BIOS setting has been changed.

Status: The BIOS configuration is updated for 10.145.129.168

Note: You have to reboot or power up the system for the changes to take effect.

7 changes: 7 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig-Changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
..................
Status: The BIOS configuration is updated for 10.145.129.168

Note: You have to reboot or power up the system for the changes to take effect.

16 changes: 16 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig-Changed-Reboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
.................
Status: The managed system 10.145.129.168 is rebooting.

.............................Done
....
.................


Note: No BIOS setting has been changed.

Status: The BIOS configuration is updated for 10.145.129.168

WARNING: Without option --post_complete, please manually confirm the managed system is POST complete before executing next action.

Loading
Loading