From 683826b0c8ad969c2b374a8c315b3cf636ddb264 Mon Sep 17 00:00:00 2001 From: Joel Rebello Date: Tue, 27 Aug 2024 12:11:02 +0200 Subject: [PATCH] cmd/power: Add support for setting pxe boot persistent and booting --- cmd/power/power.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/power/power.go b/cmd/power/power.go index 3c6485b7..80324e77 100644 --- a/cmd/power/power.go +++ b/cmd/power/power.go @@ -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") @@ -124,6 +126,7 @@ 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 @@ -131,14 +134,18 @@ func paramsFromFlags(f *powerActionFlags) (*rctypes.ServerControlTaskParameters, 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 }