webui-vue icon indicating copy to clipboard operation
webui-vue copied to clipboard

Server power operations page is not updated correctly

Open thangqn-ampere opened this issue 1 year ago • 8 comments

Describe the bug Do power operation from WebUI's Server power operations page will have the selected operation executed and change to the information page "There are no options to display ...". However, the page is stuck on this without returning to the normal page. Click on the Refresh button or click to other page and then return this page do not help. Can only go back to the normal page with the browser's Reload.

To Reproduce Steps to reproduce the behavior:

  1. Go to BMC WebUI by entering https://BMC_IP and then login with root/0penBMC
  2. Click on Operations -> Server power operations.
  3. Click on Reboot server -> "Immediate – Server reboots without operating system shutting down; may cause data corruption"
  4. Click on Reboot button -> click Confirm
  5. See below message There are no options to display while a power operation is in progress. When complete, power operations will be displayed here.
  6. Wait a minute or more to have the Host rebooted.
  7. Click on the Refresh button --> nothing happens, still stuck on the message at step 5.
  8. Change to Operations -> Firmware page.
  9. Change back to Operations -> Server power operations --> still displays message at step 5.

Expected behavior at step 7 and 10, Operations page has options for Host power control

Screenshots

  • Expected page: image
  • Current page (at step 7 and step 10): image

Desktop (please complete the following information):

  • OS: Mac OS Ventura 13.2.1
  • Browser: Firefox 110.0.1

thangqn-ampere avatar Mar 07 '23 06:03 thangqn-ampere

I've also observed this issue. Don't know the real reason for this, but I've found out that adding rest=enabled option to bmcweb helps to mitigate this issue

recipes-phosphor/interfaces/bmcweb_%.bbappend

 EXTRA_OEMESON:append = "\
     -Drest=enabled \
 "

Hope this can help to track the real problem.

Kostr avatar Mar 08 '23 12:03 Kostr

I solved the problem by replace setTimeout() by setInterval() function to after the interval of 5 seconds time, then repeating continuously at that interval until serverStatus value matches the passed argument then Stop watching status changes and resolving Promise: This change code:

+++ b/src/store/modules/Operations/ControlStore.js
@@ -4,24 +4,27 @@ import i18n from '@/i18n';
 const checkForServerStatus = function (serverStatus) {
   return new Promise((resolve) => {
-    const timer = setTimeout(() => {
+    const timer = setInterval(() => {
+      this.dispatch('global/getSystemInfo');
       resolve();
       unwatch();
-    }, 300000 /*5mins*/);
+    }, 5000); /*5seconds*/
     const unwatch = this.watch(
       (state) => state.global.serverStatus,
       (value) => {
         if (value === serverStatus) {
           resolve();
           unwatch();
-          clearTimeout(timer);
+          clearInterval(timer);
         }
       }
     );

Any better suggestions for the above change?

HuyLeAnh avatar Apr 07 '23 06:04 HuyLeAnh

can you explain why setTimeout does not work, @HuyLeAnh?

thangqn-ampere avatar Jun 08 '23 06:06 thangqn-ampere

I found the explanation about setTimeout vs setInterval at https://www.educba.com/settimeout-vs-setinterval/

thangqn-ampere avatar Jun 08 '23 06:06 thangqn-ampere

Hi,

Will this part be merged into master code?

In this page, "Refresh" button seems not work. Will this commit resolve the problem? Only F5 could update server state status.

awan119 avatar Jul 16 '24 07:07 awan119

@awan119 Can you check with patch found in Gerrit -review: https://gerrit.openbmc.org/c/openbmc/webui-vue/+/64481

huyle-anh avatar Jul 16 '24 07:07 huyle-anh

@awan119 This commit does not resolve the "Refresh" problem. The strange thing is that webui-vue sends /redfish/v1/Systems/system request but does not use it to update the webui.

Kees-T avatar Aug 28 '24 09:08 Kees-T

@awan119 This commit does not resolve the "Refresh" problem. The strange thing is that webui-vue sends /redfish/v1/Systems/system request but does not use it to update the webui.

Hi Kees,

I put getSystemInfo here to let update works : src/views/Operations/ServerPowerOperations/ServerPowerOperations.vue

 Promise.all([
      this.$store.dispatch('serverBootSettings/getBootSettings'),
      this.$store.dispatch('controls/getLastPowerOperationTime'),
      this.$store.dispatch('global/getSystemInfo'),  <-- HERE!
      bootSettingsPromise,
    ]).finally(() => this.endLoader());

awan119 avatar Sep 04 '24 03:09 awan119