Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server power operations page is not updated correctly #102

Open
thangqn-ampere opened this issue Mar 7, 2023 · 8 comments
Open

Server power operations page is not updated correctly #102

thangqn-ampere opened this issue Mar 7, 2023 · 8 comments

Comments

@thangqn-ampere
Copy link
Contributor

thangqn-ampere commented Mar 7, 2023

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
@Kostr
Copy link
Contributor

Kostr commented Mar 8, 2023

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.

@HuyLeAnh
Copy link
Contributor

HuyLeAnh commented Apr 7, 2023

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?

@thangqn-ampere
Copy link
Contributor Author

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

@thangqn-ampere
Copy link
Contributor Author

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

bradbishop pushed a commit that referenced this issue Mar 5, 2024
After reboot or shutdown CPU via WebUI, the Server status
does not update. The current implementation uses setTimeout() with
a timeout of 5 minutes, it means the server power operations page
reloads after 5 minutes.
The issue is that the power status has really changed but has not
been updated on the Server status because of the timeout.

Fix the issue by changing setTimeout() to setInterval(). The Server
status is updated after each 5 seconds.

Fixes: #102
Reference:
https://www.educba.com/settimeout-vs-setinterval/

Tested:
1. Power off the CPU via WebUI.
2. WebUI shows Server status as off and a power on button.

Change-Id: I31359d970c2aa42f29115102ddbc9cbe85fb168d
Signed-off-by: Hieu Huynh <[email protected]>
Signed-off-by: HuyLe <[email protected]>
@awan119
Copy link

awan119 commented Jul 16, 2024

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.

@huyle-anh
Copy link

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

@Kees-T
Copy link
Contributor

Kees-T commented Aug 28, 2024

@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.

@awan119
Copy link

awan119 commented Sep 4, 2024

@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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants