summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorDixsie Wolmers <dixsie@ibm.com>2020-07-15 01:07:26 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-07-20 22:00:27 +0300
commitecd45a8392af2ada59dc846defa6392f5fc208a1 (patch)
tree7abf70d1c56882d1b80ac39a3de87cf02598f225 /src/store/modules
parent9422e1a695edc0d520507ee3584592a28c5a63b3 (diff)
downloadwebui-vue-ecd45a8392af2ada59dc846defa6392f5fc208a1.tar.xz
Bug fix: Add timeout when setting Manual date & time
When time mode is initially set to Manual from NTP, the NTP service is disabled. In this process, the NTP service is stopping but not fully stopped therefore setting date/time will return an error. There are no responses from backend to notify when NTP is fully stopped. To work around, a timeout is set to allow NTP to fully stop. Signed-off-by: Dixsie Wolmers <dixsie@ibm.com> Change-Id: I8873722a72a955c355114567e56205aff7819931
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/Configuration/DateTimeSettingsStore.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/store/modules/Configuration/DateTimeSettingsStore.js b/src/store/modules/Configuration/DateTimeSettingsStore.js
index 9da0cb41..06aeefe6 100644
--- a/src/store/modules/Configuration/DateTimeSettingsStore.js
+++ b/src/store/modules/Configuration/DateTimeSettingsStore.js
@@ -30,24 +30,41 @@ const DateTimeStore = {
console.log(error);
});
},
- async updateDateTimeSettings(_, dateTimeForm) {
+ async updateDateTimeSettings({ state }, dateTimeForm) {
const ntpData = {
NTP: {
ProtocolEnabled: dateTimeForm.ntpProtocolEnabled
}
};
-
if (dateTimeForm.ntpProtocolEnabled) {
ntpData.NTP.NTPServers = dateTimeForm.ntpServersArray;
}
return await api
.patch(`/redfish/v1/Managers/bmc/NetworkProtocol`, ntpData)
- .then(() => {
+ .then(async () => {
if (!dateTimeForm.ntpProtocolEnabled) {
const dateTimeData = {
DateTime: dateTimeForm.updatedDateTime
};
- api.patch(`/redfish/v1/Managers/bmc`, dateTimeData);
+ /**
+ * https://github.com/openbmc/phosphor-time-manager/blob/master/README.md#special-note-on-changing-ntp-setting
+ * When time mode is initially set to Manual from NTP,
+ * NTP service is disabled and the NTP service is
+ * stopping but not stopped, setting time will return an error.
+ * There are no responses from backend to notify when NTP is stopped.
+ * To work around, a timeout is set to allow NTP to fully stop
+ * TODO: remove timeout if backend solves
+ * https://github.com/openbmc/openbmc/issues/3459
+ */
+ const timeoutVal = state.isNtpProtocolEnabled ? 20000 : 0;
+ return await new Promise((resolve, reject) => {
+ setTimeout(() => {
+ return api
+ .patch(`/redfish/v1/Managers/bmc`, dateTimeData)
+ .then(() => resolve())
+ .catch(() => reject());
+ }, timeoutVal);
+ });
}
})
.then(() => {