Skip to content

Commit

Permalink
outofband/actions: resetDevice is run only if host indicates it requi…
Browse files Browse the repository at this point in the history
…res a powercycle

The host power cycle is done if polling the status indicates it's required.
  • Loading branch information
joelrebel committed Nov 29, 2023
1 parent 09b0f72 commit be3f364
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
15 changes: 0 additions & 15 deletions internal/outofband/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 4 additions & 11 deletions internal/outofband/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestComposeTransitions(t *testing.T) {
uploadFirmwareInitiateInstall,
pollInstallStatus,
postInstallResetBMC,
resetDevice,
},
"",
},
Expand All @@ -94,7 +93,6 @@ func TestComposeTransitions(t *testing.T) {
installUploadedFirmware,
pollInstallStatus,
postInstallResetBMC,
resetDevice,
},
"",
},
Expand All @@ -113,7 +111,6 @@ func TestComposeTransitions(t *testing.T) {
uploadFirmwareInitiateInstall,
pollInstallStatus,
postInstallResetBMC,
resetDevice,
},
"",
},
Expand All @@ -136,7 +133,6 @@ func TestComposeTransitions(t *testing.T) {
installUploadedFirmware,
pollInstallStatus,
postInstallResetBMC,
resetDevice,
},
"",
},
Expand Down Expand Up @@ -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
},
Expand All @@ -436,7 +431,6 @@ func TestActionStateMachine(t *testing.T) {
uploadFirmwareInitiateInstall,
pollInstallStatus,
postInstallResetBMC,
resetDevice,
},
model.StateSucceeded,
},
Expand All @@ -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
},
Expand Down

0 comments on commit be3f364

Please sign in to comment.