From 5080498dfc97e28800e4174b7a64a7bbfb96aae6 Mon Sep 17 00:00:00 2001 From: Michael Buchmann Date: Mon, 29 Apr 2024 12:55:39 -0500 Subject: [PATCH 1/4] Update to timeout for Paradise --- .version | 2 +- cmd/hms-firmware-action/main.go | 2 +- cmd/hms-firmware-action/updateScheduler.go | 12 +++++++++--- internal/domain/version.go | 5 +++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.version b/.version index 34aae156..359c4108 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.31.0 +1.32.0 diff --git a/cmd/hms-firmware-action/main.go b/cmd/hms-firmware-action/main.go index c23f0cba..87d5819c 100644 --- a/cmd/hms-firmware-action/main.go +++ b/cmd/hms-firmware-action/main.go @@ -70,7 +70,7 @@ const manufacturerFoxconn = "foxconn" const ( dfltMaxHTTPRetries = 5 - dfltMaxHTTPTimeout = 40 + dfltMaxHTTPTimeout = 120 dfltMaxHTTPBackoff = 8 ) const defaultS3Endpoint = "s3" diff --git a/cmd/hms-firmware-action/updateScheduler.go b/cmd/hms-firmware-action/updateScheduler.go index 39061976..a7dbe64e 100644 --- a/cmd/hms-firmware-action/updateScheduler.go +++ b/cmd/hms-firmware-action/updateScheduler.go @@ -641,7 +641,7 @@ func doLaunch(operation storage.Operation, image storage.Image, command storage. mainLogger.Debug(operation.HsmData.UpdateURI) mainLogger.Debug(pcs) passback = SendSecureRedfish(globals, operation.HsmData.FQDN, operation.HsmData.UpdateURI, - pcs, operation.HsmData.User, operation.HsmData.Password, "POST") + pcs, operation.HsmData.User, operation.HsmData.Password, "POST", 120) if !(passback.IsError || passback.StatusCode >= 400) { // Foxconn return a link to a task which we can monitor for update progress tasklink := new(model.TaskLink) @@ -1080,7 +1080,13 @@ func fileCheck(fileLocation string) (returnLocation string, err error) { } func SendSecureRedfish(globals *domain.DOMAIN_GLOBALS, server string, path string, bodyStr string, authUser string, - authPass string, method string) (pb model.Passback) { + authPass string, method string, timeout_override ...int) (pb model.Passback) { + + timeout := 40 + if len(timeout_override) > 0 { + timeout = timeout_override[0] + } + mainLogger.WithFields(logrus.Fields{"Timeout": timeout}).Debug("TIMEOUT SETTING") tmpURL, _ := url.Parse("https://" + server + path) req, err := http.NewRequest(method, tmpURL.String(), bytes.NewBuffer([]byte(bodyStr))) @@ -1093,7 +1099,7 @@ func SendSecureRedfish(globals *domain.DOMAIN_GLOBALS, server string, path strin if !(authUser == "" && authPass == "") { req.SetBasicAuth(authUser, authPass) } - reqContext, _ := context.WithTimeout(context.Background(), time.Second*40) + reqContext, _ := context.WithTimeout(context.Background(), time.Second*time.Duration(timeout)) req = req.WithContext(reqContext) if err != nil { mainLogger.Error(err) diff --git a/internal/domain/version.go b/internal/domain/version.go index a33e3f0c..ef324ff1 100644 --- a/internal/domain/version.go +++ b/internal/domain/version.go @@ -477,6 +477,11 @@ func RetrieveTaskStatus(hd *hsm.HsmData, tasklink string) (stateStatus model.Tas logrus.Error(err) return } + if resp.StatusCode >= 400 { + err = fmt.Errorf("Task Status Code: %d", resp.StatusCode) + logrus.Error(err) + return + } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) From 93057a3740c8838cfe600992ff4b4c953d59e678 Mon Sep 17 00:00:00 2001 From: Michael Buchmann Date: Mon, 29 Apr 2024 13:41:14 -0500 Subject: [PATCH 2/4] Added Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 616be086..219de8ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.32.0] - 2024-04-29 + +- Updated timeout for Paradise updates redfish calls to 120 seconds + ## [1.31.0] - 2024-04-16 - Fixed loader zip file error From 1c27838f19fef5155a08f6a81f841610d3084868 Mon Sep 17 00:00:00 2001 From: Michael Buchmann Date: Mon, 29 Apr 2024 15:50:47 -0500 Subject: [PATCH 3/4] Update to copyright date --- internal/domain/version.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/internal/domain/version.go b/internal/domain/version.go index ef324ff1..37000caf 100644 --- a/internal/domain/version.go +++ b/internal/domain/version.go @@ -1,7 +1,7 @@ /* * MIT License * - * (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP + * (C) Copyright [2020-2024] Hewlett Packard Enterprise Development LP * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -79,11 +79,13 @@ func GetCurrentFirmwareVersionsFromParams(params storage.SnapshotParameters) (de //TODO Perhaps move THIS to a global? Not going to do it In June of 2020 b.c it works and // I dont want to spend the time monkeying around with it! - specialTargets := make(map[string]string) - specialTargets["node0.bios"] = "/redfish/v1/Systems/Node0" - specialTargets["node1.bios"] = "/redfish/v1/Systems/Node1" + /* + specialTargets := make(map[string]string) + specialTargets["node0.bios"] = "/redfish/v1/Systems/Node0" + specialTargets["node1.bios"] = "/redfish/v1/Systems/Node1" - (*GLOB.HSM).RefillModelRF(&XnameTargetHSMMap, specialTargets) + (*GLOB.HSM).RefillModelRF(&XnameTargetHSMMap, specialTargets) + */ FilterModelManufacturer(&XnameTargetHSMMap, params.InventoryHardwareFilter) devicesThatareNOTDiscoveredOK, errr := PruneXnameTargetList(&XnameTargetHSMMap) @@ -251,9 +253,16 @@ func RetrieveFirmwareVersionFromTargets(hd *map[hsm.XnameTarget]hsm.HsmData) (de } continue } + // THIS IS WHERE WE GET THE VERSION FROM REDFISH MJB hsmdata := (*hd)[xnameTarget] taskMap[taskList[counter].GetID()] = xnameTarget urlStr, _ := GetFirmwareVersionURL(hsmdata, xnameTarget.Target) + /* cFirmware + uFirmwarePod := "cFirmwarePod:5000" + urlStr := "http://" + uFirmwarePod + "/firmwareVersion/" + hsmdata.FQDN + "/" + xnameTarget.Target + "?user=" + hsmdata.User + "&password=" + hsmdata.Password + fmt.Println("-----VERSION URL------------") + fmt.Println(urlStr) + */ taskList[counter].Request.URL, _ = url.Parse(urlStr) taskList[counter].Timeout = time.Second * 40 taskList[counter].RetryPolicy.Retries = 3 From 006ec288f574899cec328465e2a725ea2577597a Mon Sep 17 00:00:00 2001 From: Michael Buchmann Date: Mon, 29 Apr 2024 16:02:29 -0500 Subject: [PATCH 4/4] Removed test code --- internal/domain/version.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/internal/domain/version.go b/internal/domain/version.go index 37000caf..cc69d94e 100644 --- a/internal/domain/version.go +++ b/internal/domain/version.go @@ -79,13 +79,11 @@ func GetCurrentFirmwareVersionsFromParams(params storage.SnapshotParameters) (de //TODO Perhaps move THIS to a global? Not going to do it In June of 2020 b.c it works and // I dont want to spend the time monkeying around with it! - /* - specialTargets := make(map[string]string) - specialTargets["node0.bios"] = "/redfish/v1/Systems/Node0" - specialTargets["node1.bios"] = "/redfish/v1/Systems/Node1" + specialTargets := make(map[string]string) + specialTargets["node0.bios"] = "/redfish/v1/Systems/Node0" + specialTargets["node1.bios"] = "/redfish/v1/Systems/Node1" - (*GLOB.HSM).RefillModelRF(&XnameTargetHSMMap, specialTargets) - */ + (*GLOB.HSM).RefillModelRF(&XnameTargetHSMMap, specialTargets) FilterModelManufacturer(&XnameTargetHSMMap, params.InventoryHardwareFilter) devicesThatareNOTDiscoveredOK, errr := PruneXnameTargetList(&XnameTargetHSMMap) @@ -253,16 +251,9 @@ func RetrieveFirmwareVersionFromTargets(hd *map[hsm.XnameTarget]hsm.HsmData) (de } continue } - // THIS IS WHERE WE GET THE VERSION FROM REDFISH MJB hsmdata := (*hd)[xnameTarget] taskMap[taskList[counter].GetID()] = xnameTarget urlStr, _ := GetFirmwareVersionURL(hsmdata, xnameTarget.Target) - /* cFirmware - uFirmwarePod := "cFirmwarePod:5000" - urlStr := "http://" + uFirmwarePod + "/firmwareVersion/" + hsmdata.FQDN + "/" + xnameTarget.Target + "?user=" + hsmdata.User + "&password=" + hsmdata.Password - fmt.Println("-----VERSION URL------------") - fmt.Println(urlStr) - */ taskList[counter].Request.URL, _ = url.Parse(urlStr) taskList[counter].Timeout = time.Second * 40 taskList[counter].RetryPolicy.Retries = 3