summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorLeo Xu <yongquanx@nvidia.com>2024-07-29 05:54:18 +0300
committerjwestover <jwestover@nvidia.com>2024-09-10 23:42:16 +0300
commite2c716a91f3cf130427600c26ae58de0f9750f2a (patch)
tree866e575670b779f53a35e522d47ea3ba57a585fe /src/store/modules
parent8876eceffa71ed8b28a856c48a8acb18167c9340 (diff)
downloadwebui-vue-e2c716a91f3cf130427600c26ae58de0f9750f2a.tar.xz
Add support for MultipartHttpPushUri in fw push
According to the Redfish Firmware Update Whitepaper [1] due to the vendor-specific details of this operation, HttpPushUri has been deprecated in favor of multipartHTTP push updates. Availability of update methods is determined from the UpdateService response. If MultipartHttpPushUri is found it will be preferred over HttpPushUri Tested: -Firmware update by performed via MultipartHttpPushUri [1]: https://www.dmtf.org/sites/default/files/standards/documents/DSP2062_1.0.1.pdf Change-Id: I184a889514d5f9f9598f35b2281404335bc0bc82 Signed-off-by: Leo Xu <yongquanx@nvidia.com>
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/Operations/FirmwareStore.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/store/modules/Operations/FirmwareStore.js b/src/store/modules/Operations/FirmwareStore.js
index ca3ed523..6c216da8 100644
--- a/src/store/modules/Operations/FirmwareStore.js
+++ b/src/store/modules/Operations/FirmwareStore.js
@@ -9,6 +9,7 @@ const FirmwareStore = {
bmcActiveFirmwareId: null,
hostActiveFirmwareId: null,
applyTime: null,
+ multipartHttpPushUri: null,
httpPushUri: null,
},
getters: {
@@ -41,6 +42,8 @@ const FirmwareStore = {
setHostFirmware: (state, firmware) => (state.hostFirmware = firmware),
setApplyTime: (state, applyTime) => (state.applyTime = applyTime),
setHttpPushUri: (state, httpPushUri) => (state.httpPushUri = httpPushUri),
+ setMultipartHttpPushUri: (state, multipartHttpPushUri) =>
+ (state.multipartHttpPushUri = multipartHttpPushUri),
},
actions: {
async getFirmwareInformation({ dispatch }) {
@@ -110,10 +113,21 @@ const FirmwareStore = {
commit('setApplyTime', applyTime);
const httpPushUri = data.HttpPushUri;
commit('setHttpPushUri', httpPushUri);
+ const multipartHttpPushUri = data.MultipartHttpPushUri;
+ commit('setMultipartHttpPushUri', multipartHttpPushUri);
})
.catch((error) => console.log(error));
},
- async uploadFirmware({ state }, image) {
+ async uploadFirmware({ state, dispatch }, params) {
+ if (state.multipartHttpPushUri != null) {
+ return dispatch('uploadFirmwareMultipartHttpPush', params);
+ } else if (state.httpPushUri != null) {
+ return dispatch('uploadFirmwareHttpPush', params);
+ } else {
+ console.log('Do not support firmware push update');
+ }
+ },
+ async uploadFirmwareHttpPush({ state }, { image }) {
return await api
.post(state.httpPushUri, image, {
headers: { 'Content-Type': 'application/octet-stream' },
@@ -123,6 +137,21 @@ const FirmwareStore = {
throw new Error(i18n.t('pageFirmware.toast.errorUpdateFirmware'));
});
},
+ async uploadFirmwareMultipartHttpPush({ state }, { image, targets }) {
+ const formData = new FormData();
+ formData.append('UpdateFile', image);
+ let params = {};
+ if (targets != null && targets.length > 0) params.Targets = targets;
+ formData.append('UpdateParameters', JSON.stringify(params));
+ return await api
+ .post(state.multipartHttpPushUri, formData, {
+ headers: { 'Content-Type': 'multipart/form-data' },
+ })
+ .catch((error) => {
+ console.log(error);
+ throw new Error(i18n.t('pageFirmware.toast.errorUpdateFirmware'));
+ });
+ },
async switchBmcFirmwareAndReboot({ getters }) {
const backupLocation = getters.backupBmcFirmware.location;
const data = {