Skip to content

Commit

Permalink
cmd/power: Add support for setting pxe boot persistent and booting
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Aug 27, 2024
1 parent 4044e46 commit 683826b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/power/power.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ var (
"soft",
"status",
"bmc-reset",
// set PXE boot persistent and power on/cycle the server
"boot-pxe-persistent",
}

errInvalidAction = errors.New("invalid power action requested")
Expand Down Expand Up @@ -124,21 +126,26 @@ func paramsFromFlags(f *powerActionFlags) (*rctypes.ServerControlTaskParameters,

var action rctypes.ServerControlAction

var bootDevicePersistent, efiBoot bool
switch actionParam {
case "on", "off", "cycle", "reset", "soft":
action = rctypes.SetPowerState
case "bmc-reset":
action = rctypes.PowerCycleBMC
case "status":
action = rctypes.GetPowerState
case "boot-pxe-persistent":
action = rctypes.PxeBootPersistent
bootDevicePersistent = true
efiBoot = true
}

return rctypes.NewServerControlTaskParameters(
uuid.MustParse(f.serverID),
action,
actionParam,
false,
false,
bootDevicePersistent,
efiBoot,
), nil
}

Expand Down

0 comments on commit 683826b

Please sign in to comment.