From d4fa8c8b124f02baeb7b32bbada141257cbcf06e Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Wed, 28 Feb 2024 20:10:14 +0100 Subject: [PATCH] Apply disks changes when retrying save requests Signed-off-by: Francesco Torchia --- pkg/harvester/edit/harvesterhci.io.host/index.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/harvester/edit/harvesterhci.io.host/index.vue b/pkg/harvester/edit/harvesterhci.io.host/index.vue index 1e804839a92..7536dfe727b 100644 --- a/pkg/harvester/edit/harvesterhci.io.host/index.vue +++ b/pkg/harvester/edit/harvesterhci.io.host/index.vue @@ -337,7 +337,7 @@ export default { tagDisks = this.newDisks.filter(d => d.blockDevice && !isEqual(d.blockDevice.spec.tags, d.tags)); if (tagDisks.length === 0) { - return Promise.resolve(); + return Promise.resolve(); } } else if (addDisks.length !== 0 && removeDisks.length === 0) { const updatedDisks = addDisks.filter((d) => { @@ -493,16 +493,17 @@ export default { async saveLonghornNode() { const inStore = this.$store.getters['currentProduct'].inStore; - const disks = this.longhornNode?.spec?.disks || {}; - - this.newDisks.map((disk) => { - (disks[disk.name] || {}).tags = disk.tags; - }); + const storageTags = clone(this.longhornNode?.spec?.tags); let count = 0; const retrySave = async() => { try { + this.longhornNode.spec.tags = storageTags; + this.newDisks.forEach((disk) => { + (this.longhornNode?.spec?.disks?.[disk.name] || {}).tags = disk.tags; + }); + await this.longhornNode.save(); } catch (err) { if ((err.status === 409 || err.status === 403) && count < 3) {