Change host status request to Redfish
Use /redfish/v1/Systems/system Redfish endpoint to get
host status from PowerState property.
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: Ied2e70d5e26eb820d41d6b63acdded237f7646a4
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 057f515..83b5432 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -10,10 +10,13 @@
const hostStateMapper = hostState => {
switch (hostState) {
case HOST_STATE.on:
+ case 'On': // Redfish PowerState
return 'on';
case HOST_STATE.off:
+ case 'Off': // Redfish PowerState
return 'off';
case HOST_STATE.error:
+ // TODO: Map Redfish Quiesced when bmcweb supports
return 'error';
// TODO: Add mapping for DiagnosticMode
default:
@@ -61,10 +64,9 @@
},
getHostStatus({ commit }) {
api
- .get('/xyz/openbmc_project/state/host0/attr/CurrentHostState')
- .then(response => {
- const hostState = response.data.data;
- commit('setHostStatus', hostState);
+ .get('/redfish/v1/Systems/system')
+ .then(({ data: { PowerState } } = {}) => {
+ commit('setHostStatus', PowerState);
})
.catch(error => console.log(error));
}