summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Xu <yongquanx@nvidia.com>2024-07-29 05:54:18 +0300
committerSurya Venkatesan <suryav@ami.com>2024-10-03 17:10:53 +0300
commita27fb4c030ded27a286e3394d8827388d0bed302 (patch)
tree3f3659d0045eec4bbecc552589697f8657665a44
parent5996b3df28f8f8cbb4b97417ad1e3972139c09a6 (diff)
downloadwebui-vue-a27fb4c030ded27a286e3394d8827388d0bed302.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> Signed-off-by: Surya Venkatesan <suryav@ami.com>
-rw-r--r--src/store/modules/Operations/FirmwareStore.js33
-rw-r--r--src/views/Operations/Firmware/FirmwareFormUpdate.vue4
2 files changed, 35 insertions, 2 deletions
diff --git a/src/store/modules/Operations/FirmwareStore.js b/src/store/modules/Operations/FirmwareStore.js
index 83871092..0015486d 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' },
@@ -125,6 +139,23 @@ const FirmwareStore = {
);
});
},
+ 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.global.t('pageFirmware.toast.errorUpdateFirmware'),
+ );
+ });
+ },
async switchBmcFirmwareAndReboot({ getters }) {
const backupLocation = getters.backupBmcFirmware.location;
const data = {
diff --git a/src/views/Operations/Firmware/FirmwareFormUpdate.vue b/src/views/Operations/Firmware/FirmwareFormUpdate.vue
index abb25fc4..43467474 100644
--- a/src/views/Operations/Firmware/FirmwareFormUpdate.vue
+++ b/src/views/Operations/Firmware/FirmwareFormUpdate.vue
@@ -110,7 +110,9 @@ export default {
},
dispatchWorkstationUpload(timerId) {
this.$store
- .dispatch('firmware/uploadFirmware', this.file)
+ .dispatch('firmware/uploadFirmware', {
+ image: this.file,
+ })
.catch(({ message }) => {
this.endLoader();
this.errorToast(message);