From a9388789da5378bcc633fc8e5f029f14c680cac8 Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Tue, 25 Feb 2025 18:08:49 +0530 Subject: [PATCH] Update Safe mode - Updated the redfish end-point and Property to determine the Safe mode for the System. - JIRA: https://jsw.ibm.com/browse/PFEBMC-2901 Signed-off-by: Nikhil Ashoka --- src/store/modules/GlobalStore.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index ad2b96a6aa..f8a05b4891 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -180,7 +180,7 @@ const GlobalStore = { }) .catch((error) => console.log(error)); }, - getSystemInfo({ commit }) { + getSystemInfo({ dispatch, commit }) { api .get('/redfish/v1/Systems/system') .then( @@ -190,9 +190,6 @@ const GlobalStore = { Model, PowerState, SerialNumber, - Oem: { - IBM: { SafeMode }, - }, Status: { State } = {}, }, } = {}) => { @@ -200,7 +197,6 @@ const GlobalStore = { commit('setSerialNumber', SerialNumber); commit('setModelType', Model); localStorage.setItem('storedModelType', Model); - commit('setSafeMode', SafeMode); if (State === 'Quiesced' || State === 'InTest') { // OpenBMC's host state interface is mapped to 2 Redfish // properties "Status""State" and "PowerState". Look first @@ -209,6 +205,7 @@ const GlobalStore = { } else { commit('setServerStatus', PowerState); } + dispatch('getSafeMode'); } ) .catch((error) => { @@ -233,6 +230,26 @@ const GlobalStore = { return data; }); }, + async getSafeMode({ commit }) { + return api + .get('/redfish/v1/Systems/system/Processors?$expand=.($levels=2)') + .then(({ data }) => { + commit('setSafeMode', false); + for (let member of data.Members) { + if ( + member?.Throttled && + member?.ThrottleCauses.includes('ManagementDetectedFault') + ) { + commit('setSafeMode', true); + break; + } + } + }) + .catch((error) => { + console.log(error); + return Promise.reject(error); + }); + }, }, };