Skip to content

Commit

Permalink
Merge pull request #1954 from derekhiggins/httpboot
Browse files Browse the repository at this point in the history
✨ Add redfish-uefihttp driver
  • Loading branch information
metal3-io-bot authored Sep 24, 2024
2 parents 13a07a3 + cd1827d commit 38b2471
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/hardwareutils/bmc/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@ func TestStaticDriverInfo(t *testing.T) {
power: "",
},

{
Scenario: "redfish uefi http boot",
input: "redfish-uefihttp+https://192.168.122.1",
needsMac: true,
driver: "redfish",
bios: "",
boot: "redfish-https",
firmware: "redfish",
management: "",
power: "",
},

{
Scenario: "idrac redfish",
input: "idrac-redfish://192.168.122.1",
Expand Down
114 changes: 114 additions & 0 deletions pkg/hardwareutils/bmc/redfish_https.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package bmc

import (
"fmt"
"net/url"
)

func init() {
schemes := []string{"http", "https"}
RegisterFactory("redfish-uefihttp", newRedfishHTTPBootMediaAccessDetails, schemes)
}

func newRedfishHTTPBootMediaAccessDetails(parsedURL *url.URL, disableCertificateVerification bool) (AccessDetails, error) {
return &redfishHTTPBootMediaAccessDetails{
bmcType: parsedURL.Scheme,
host: parsedURL.Host,
path: parsedURL.Path,
disableCertificateVerification: disableCertificateVerification,
}, nil
}

type redfishHTTPBootMediaAccessDetails struct {
bmcType string
host string
path string
disableCertificateVerification bool
}

func (a *redfishHTTPBootMediaAccessDetails) Type() string {
return a.bmcType
}

// NeedsMAC returns true when the host is going to need a separate
// port created rather than having it discovered.
func (a *redfishHTTPBootMediaAccessDetails) NeedsMAC() bool {
// For the inspection to work, we need a MAC address
// https://github.com/metal3-io/baremetal-operator/pull/284#discussion_r317579040
return true
}

func (a *redfishHTTPBootMediaAccessDetails) Driver() string {
return redfish
}

func (a *redfishHTTPBootMediaAccessDetails) DisableCertificateVerification() bool {
return a.disableCertificateVerification
}

// DriverInfo returns a data structure to pass as the DriverInfo
// parameter when creating a node in Ironic. The structure is
// pre-populated with the access information, and the caller is
// expected to add any other information that might be needed (such as
// the kernel and ramdisk locations).
func (a *redfishHTTPBootMediaAccessDetails) DriverInfo(bmcCreds Credentials) map[string]interface{} {
result := map[string]interface{}{
"redfish_system_id": a.path,
"redfish_username": bmcCreds.Username,
"redfish_password": bmcCreds.Password,
"redfish_address": getRedfishAddress(a.bmcType, a.host),
}

if a.disableCertificateVerification {
result["redfish_verify_ca"] = false
}

return result
}

func (a *redfishHTTPBootMediaAccessDetails) BIOSInterface() string {
return ""
}

func (a *redfishHTTPBootMediaAccessDetails) BootInterface() string {
return "redfish-https"
}

func (a *redfishHTTPBootMediaAccessDetails) FirmwareInterface() string {
return redfish
}

func (a *redfishHTTPBootMediaAccessDetails) ManagementInterface() string {
return ""
}

func (a *redfishHTTPBootMediaAccessDetails) PowerInterface() string {
return ""
}

func (a *redfishHTTPBootMediaAccessDetails) RAIDInterface() string {
return redfish
}

func (a *redfishHTTPBootMediaAccessDetails) VendorInterface() string {
return ""
}

func (a *redfishHTTPBootMediaAccessDetails) SupportsSecureBoot() bool {
return true
}

func (a *redfishHTTPBootMediaAccessDetails) SupportsISOPreprovisioningImage() bool {
return true
}

func (a *redfishHTTPBootMediaAccessDetails) RequiresProvisioningNetwork() bool {
return false
}

func (a *redfishHTTPBootMediaAccessDetails) BuildBIOSSettings(firmwareConfig *FirmwareConfig) (settings []map[string]string, err error) {
if firmwareConfig != nil {
return nil, fmt.Errorf("firmware settings for %s are not supported", a.Driver())
}
return nil, nil
}

0 comments on commit 38b2471

Please sign in to comment.