From 9467b1f063535795cdf69f8f650dc85adc69b6c1 Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Wed, 6 Dec 2023 13:37:51 +0100 Subject: [PATCH] openbmc, supermicro: implement BMCResetter interface This makes sure when the provider is pinned/filtered* the BmcReset method is available. * https://github.com/bmc-toolbox/bmclib#one-time-filtering --- providers/openbmc/openbmc.go | 6 ++++++ providers/supermicro/supermicro.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/providers/openbmc/openbmc.go b/providers/openbmc/openbmc.go index 259c49ba..7a00737b 100644 --- a/providers/openbmc/openbmc.go +++ b/providers/openbmc/openbmc.go @@ -29,6 +29,7 @@ var ( Features = registrar.Features{ providers.FeaturePowerState, providers.FeaturePowerSet, + providers.FeatureBmcReset, providers.FeatureFirmwareInstallSteps, providers.FeatureFirmwareUploadInitiateInstall, providers.FeatureFirmwareTaskStatus, @@ -178,3 +179,8 @@ func (c *Conn) PowerSet(ctx context.Context, state string) (ok bool, err error) func (c *Conn) Inventory(ctx context.Context) (device *common.Device, err error) { return c.redfishwrapper.Inventory(ctx, false) } + +// BmcReset power cycles the BMC +func (c *Conn) BmcReset(ctx context.Context, resetType string) (ok bool, err error) { + return c.redfishwrapper.BMCReset(ctx, resetType) +} diff --git a/providers/supermicro/supermicro.go b/providers/supermicro/supermicro.go index b201e374..53b15929 100644 --- a/providers/supermicro/supermicro.go +++ b/providers/supermicro/supermicro.go @@ -50,6 +50,7 @@ var ( providers.FeatureInventoryRead, providers.FeaturePowerSet, providers.FeaturePowerState, + providers.FeatureBmcReset, } ) @@ -210,6 +211,15 @@ func (c *Client) PowerSet(ctx context.Context, state string) (ok bool, err error return c.serviceClient.redfish.PowerSet(ctx, state) } +// BmcReset power cycles the BMC +func (c *Client) BmcReset(ctx context.Context, resetType string) (ok bool, err error) { + if c.serviceClient == nil || c.serviceClient.redfish == nil { + return false, errors.Wrap(bmclibErrs.ErrLoginFailed, "client not initialized") + } + + return c.serviceClient.redfish.BMCReset(ctx, resetType) +} + // Inventory collects hardware inventory and install firmware information func (c *Client) Inventory(ctx context.Context) (device *common.Device, err error) { if c.serviceClient == nil || c.serviceClient.redfish == nil {