Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/views/Operations/Firmware/Firmware.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ const isOperationInProgress = computed(() => {

const isPageDisabled = computed(() => {
if (isServerPowerOffRequired.value) {
return !isServerOff.value || loading.value || isOperationInProgress.value;
// Only disable if server is explicitly on (not off and not unreachable)
// If power status is unavailable (unreachable), allow operations
const shouldDisableForPower =
serverStatus.value !== 'unreachable' && !isServerOff.value;
return (
shouldDisableForPower || loading.value || isOperationInProgress.value
);
}
return isLoading.value || isOperationInProgress.value;
});
Expand Down
32 changes: 20 additions & 12 deletions src/views/Operations/Firmware/FirmwareCardsBmc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
variant="link"
size="sm"
class="py-0 px-1 mt-2"
:disabled="isPageDisabled || !backup || !isServerOff"
:disabled="
isPageDisabled ||
!backup ||
(serverStatus !== 'unreachable' && !isServerOff)
"
@click="showConfirmationModal"
>
<icon-switch class="d-none d-sm-inline-block" />
Expand Down Expand Up @@ -102,14 +106,14 @@ defineProps({
},
});

const serverStatus = computed(() => {
return globalStore.serverStatusGetter;
});

const switchToBackupImageDisabled = ref(
import.meta.env.VITE_APP_SWITCH_TO_BACKUP_IMAGE_DISABLED === 'true',
);

const bootProgress = computed(() => {
return globalStore.bootProgressGetter;
});

const isSingleFileUploadEnabled = computed(() => {
return firmwareStore.isSingleFileUploadEnabled;
});
Expand Down Expand Up @@ -164,7 +168,6 @@ function showConfirmationModal() {
function switchToRunning() {
startLoader();
emit('loadingStatus', loading.value);
console.log('confirm');

// Step 1 - Switch firmware
const switchFirmware = () => {
Expand Down Expand Up @@ -207,15 +210,20 @@ function switchToRunning() {
i18n.global.t('pageFirmware.toast.errorSwitchImages'),
);
}
globalStore.getBootProgress().then(() => {
if (bootProgress.value) {

// Check if BMC is back online by verifying API response
globalStore
.getSystemInfo()
.then(() => {
// BMC is responding, go to step 3
step3();
} else {
})
.catch(() => {
// BMC not responding yet, retry in 1 minute
setTimeout(() => {
timer(checkCounter);
}, 60000); // 1 minute;
}
});
}, 60000);
});
};
timer();
};
Expand Down
37 changes: 25 additions & 12 deletions src/views/Operations/Firmware/FirmwareFormUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ const bmcPowerState = computed(() => {
return bmcStore.bmcGetter?.powerState;
});

const bootProgress = computed(() => {
return globalStore.bootProgressGetter;
});

const rules = computed(() => ({
file: {
required: required,
Expand Down Expand Up @@ -200,20 +196,37 @@ function updateFirmware() {
timestamp: true,
});

const rebootProgress = async () => {
setTimeout(async () => {
const rebootProgress = (checkCounter = 0) => {
checkCounter++;

// This counter goes up by 1 every time this function runs
// If the function successfully goes to last toast, it won't run anymore
// if this function runs more than 36 times, it won't run anymore
if (checkCounter > 36) {
endLoader();
return errorToast(i18n.global.t('pageFirmware.toast.errorActivation'));
}

setTimeout(() => {
bmcStore
.getBmcInfo()
.then(() => {
if (bmcPowerState.value === 'On') {
activationComplete();
if (bmcPowerState.value) {
// Power state is available — original logic
if (bmcPowerState.value === 'On') {
activationComplete();
} else {
rebootProgress(checkCounter);
}
} else {
rebootProgress();
// Power state unavailable (passive BMC) —
// getBmcInfo() responding is sufficient to confirm BMC is back
activationComplete();
}
})
.catch(({ message }) => {
endLoader();
errorToast(message);
.catch(() => {
// BMC not responding yet, retry
rebootProgress(checkCounter);
});
}, 180000); // 3 minutes
};
Expand Down
Loading