From be3f364742b855add04dfd4110d4da77619cd294 Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Tue, 28 Nov 2023 17:47:48 +0100 Subject: [PATCH] outofband/actions: resetDevice is run only if host indicates it requires a powercycle The host power cycle is done if polling the status indicates it's required. --- internal/outofband/actions.go | 15 --------------- internal/outofband/actions_test.go | 15 ++++----------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/internal/outofband/actions.go b/internal/outofband/actions.go index 65667d3d..7185e348 100644 --- a/internal/outofband/actions.go +++ b/internal/outofband/actions.go @@ -351,21 +351,6 @@ func definitions() Transitions { Description: "This action state indicates the BMC has been power cycled as a post-install step to complete a component firmware install.", }, }, - { - Name: resetDevice, - Kind: PostInstall, - DestState: "deviceReset", // rename to powerCycleHost - Handler: handler.resetDevice, - PostTransition: handler.publishStatus, - TransitionDoc: sw.TransitionRuleDoc{ - Name: "Powercycle Device", - Description: "Powercycle Device - only when pollFirmwareInstallStatus() identifies a Device power cycle is required.", - }, - DestStateDoc: sw.StateDoc{ - Name: "deviceReset", - Description: "This action state indicates the Device has been (conditionally) power cycled to complete a component firmware install.", - }, - }, { Name: powerOffDevice, Kind: PowerStateOff, diff --git a/internal/outofband/actions_test.go b/internal/outofband/actions_test.go index 7c90233f..2710cb31 100644 --- a/internal/outofband/actions_test.go +++ b/internal/outofband/actions_test.go @@ -72,7 +72,6 @@ func TestComposeTransitions(t *testing.T) { uploadFirmwareInitiateInstall, pollInstallStatus, postInstallResetBMC, - resetDevice, }, "", }, @@ -94,7 +93,6 @@ func TestComposeTransitions(t *testing.T) { installUploadedFirmware, pollInstallStatus, postInstallResetBMC, - resetDevice, }, "", }, @@ -113,7 +111,6 @@ func TestComposeTransitions(t *testing.T) { uploadFirmwareInitiateInstall, pollInstallStatus, postInstallResetBMC, - resetDevice, }, "", }, @@ -136,7 +133,6 @@ func TestComposeTransitions(t *testing.T) { installUploadedFirmware, pollInstallStatus, postInstallResetBMC, - resetDevice, }, "", }, @@ -416,15 +412,14 @@ func TestActionStateMachine(t *testing.T) { q.EXPECT().Open(gomock.Any()).Return(nil).Times(1) q.EXPECT().PowerStatus(gomock.Any()).Return("on", nil).Times(1) - q.EXPECT().FirmwareInstall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1) + q.EXPECT().FirmwareInstallUploadAndInitiate(gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1) q.EXPECT().FirmwareTaskStatus( gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), - gomock.Any(), - ).AnyTimes().Return(bconsts.FirmwareInstallComplete, "some status", nil) + ).AnyTimes().Return(bconsts.Complete, "some status", nil) return ctrl, q }, @@ -436,7 +431,6 @@ func TestActionStateMachine(t *testing.T) { uploadFirmwareInitiateInstall, pollInstallStatus, postInstallResetBMC, - resetDevice, }, model.StateSucceeded, }, @@ -463,15 +457,14 @@ func TestActionStateMachine(t *testing.T) { q.EXPECT().Open(gomock.Any()).Return(nil).Times(1) q.EXPECT().PowerStatus(gomock.Any()).Return("on", nil).Times(1) - q.EXPECT().FirmwareInstall(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1) + q.EXPECT().FirmwareInstallUploadAndInitiate(gomock.Any(), gomock.Any(), gomock.Any()).Return("123", nil).Times(1) q.EXPECT().FirmwareTaskStatus( gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), - gomock.Any(), - ).AnyTimes().Return(bconsts.FirmwareInstallFailed, "some status", nil) + ).AnyTimes().Return(bconsts.Failed, "some status", nil) return ctrl, q },