mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-09-10 22:14:48 -05:00
feat(xo6): add restart toolstack host button (#10178)
* feat(xo6): rebase from master * add check restart toolstack on buttons * add tooltip message * Fix for PR * remove loader * add chengelog * remove route map * return form PR
This commit is contained in:
@@ -134,6 +134,11 @@ const textMappingsByObject: TextMappingByObject = {
|
||||
message: t('modal:host-smart-reboot-message'),
|
||||
action: t('action:smart-reboot-host'),
|
||||
},
|
||||
'restart-toolstack': {
|
||||
title: t('modal:confirm-host-restart-toolstack?', { host: hostName }),
|
||||
message: t('modal:host-restart-toolstack-message'),
|
||||
action: t('action:restart-toolstack'),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
"action:reboot": "Reboot",
|
||||
"action:reboot-host": "@:action:reboot host",
|
||||
"action:reformat": "Reformat",
|
||||
"action:restart-toolstack": "Restart toolstack",
|
||||
"action:resume": "Resume",
|
||||
"action:revert-to-snapshot": "Revert to snapshot",
|
||||
"action:revert-vm-here": "Revert VM here",
|
||||
@@ -515,6 +516,9 @@
|
||||
"job:host-reboot:evacuate-in-progress": "Evacuate VMs in progress…",
|
||||
"job:host-reboot:in-progress": "Host reboot in progress…",
|
||||
"job:host-reboot:missing-host": "No host to reboot",
|
||||
"job:host-restart-toolstack:bad-power-state": "Host is not running",
|
||||
"job:host-restart-toolstack:in-progress": "Host toolstack restart in progress…",
|
||||
"job:host-restart-toolstack:missing-host": "No host to restart toolstack on",
|
||||
"job:host-scan-pifs:bad-power-state": "Host is not running",
|
||||
"job:host-scan-pifs:in-progress": "@:scan-pifs in progress…",
|
||||
"job:host-scan-pifs:missing-host": "Host is missing",
|
||||
@@ -685,6 +689,7 @@
|
||||
"modal:confirm-host-force-reboot?": "Are you sure you want to force reboot {host}?",
|
||||
"modal:confirm-host-forget?": "Are you sure you want to forget {host}?",
|
||||
"modal:confirm-host-reboot?": "Are you sure you want to reboot {host}?",
|
||||
"modal:confirm-host-restart-toolstack?": "Are you sure you want to restart the toolstack of {host}?",
|
||||
"modal:confirm-host-shutdown?": "Are you sure you want to shut down {host}?",
|
||||
"modal:confirm-host-smart-reboot?": "Are you sure you want to smart reboot {host}?",
|
||||
"modal:confirm-host-start?": "Are you sure you want to start {host}?",
|
||||
@@ -698,6 +703,7 @@
|
||||
"modal:host-force-reboot-message": "The host is about to reboot. Its running VMs will be migrated to other hosts when possible, but those that can't be will be forcibly shut down. Data loss may occur.",
|
||||
"modal:host-forget-message": "This will permanently remove the host from the pool database. Only do this if the host is physically gone or unrecoverable - if it can come back online, use Detach instead. This action cannot be undone.",
|
||||
"modal:host-reboot-message": "The host is about to reboot. Its running VMs will be migrated to other hosts and won't be moved back to it automatically afterwards.",
|
||||
"modal:host-restart-toolstack-message": "The host's management service (toolstack) is about to restart. Running VMs won't be interrupted, but they'll be temporarily unmanageable (a few minutes).",
|
||||
"modal:host-shutdown-message": "This will power off the host. Any VMs still running on it will be shut down immediately unless you've migrated them first.",
|
||||
"modal:host-smart-reboot-message": "All running VMs on this host will be suspended, the host will reboot, then the VMs will automatically resume. This causes temporary downtime. If Xen Orchestra itself runs on this host, VMs may not resume automatically.",
|
||||
"modal:pool-disconnect-message": "The pool will no longer be manageable from XO. You can reconnect it later.",
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
"action:reboot": "Redémarrer",
|
||||
"action:reboot-host": "@:action:reboot l'hôte",
|
||||
"action:reformat": "Reformater",
|
||||
"action:restart-toolstack": "Redémarrer le toolstack",
|
||||
"action:resume": "Reprendre",
|
||||
"action:revert-to-snapshot": "Revenir à l'instantané",
|
||||
"action:revert-vm-here": "Restaurer la VM à cet instantané",
|
||||
@@ -515,6 +516,9 @@
|
||||
"job:host-reboot:evacuate-in-progress": "Évacuation des VMs en cours…",
|
||||
"job:host-reboot:in-progress": "Redémarrage de l'hôte en cours…",
|
||||
"job:host-reboot:missing-host": "Aucun hôte à redémarrer",
|
||||
"job:host-restart-toolstack:bad-power-state": "L'hôte n'est pas démarré",
|
||||
"job:host-restart-toolstack:in-progress": "Redémarrage du toolstack de l'hôte en cours…",
|
||||
"job:host-restart-toolstack:missing-host": "Aucun hôte sur lequel redémarrer le toolstack",
|
||||
"job:host-scan-pifs:bad-power-state": "L'hôte n'est pas lancé",
|
||||
"job:host-scan-pifs:in-progress": "@:scan-pifs en cours…",
|
||||
"job:host-scan-pifs:missing-host": "L'hôte est manquant",
|
||||
@@ -685,6 +689,7 @@
|
||||
"modal:confirm-host-force-reboot?": "Êtes-vous sûr de vouloir forcer le redémarrage de {host} ?",
|
||||
"modal:confirm-host-forget?": "Êtes-vous sûr de vouloir oublier {host} ?",
|
||||
"modal:confirm-host-reboot?": "Êtes-vous sûr de vouloir redémarrer {host} ?",
|
||||
"modal:confirm-host-restart-toolstack?": "Êtes-vous sûr de vouloir redémarrer le toolstack de {host} ?",
|
||||
"modal:confirm-host-shutdown?": "Êtes-vous sûr de vouloir arrêter {host} ?",
|
||||
"modal:confirm-host-smart-reboot?": "Êtes-vous sûr de vouloir effectuer un redémarrage optimisé de {host} ?",
|
||||
"modal:confirm-host-start?": "Êtes-vous sûr de vouloir démarrer {host} ?",
|
||||
@@ -698,6 +703,7 @@
|
||||
"modal:host-force-reboot-message": "L'hôte est sur le point de redémarrer. Ses VMs en cours d'exécution seront migrées vers d'autres hôtes lorsque cela sera possible, mais celles qui ne peuvent pas l'être seront arrêtées de force. Une perte de données peut survenir.",
|
||||
"modal:host-forget-message": "Cela supprimera définitivement l'hôte de la base de données du pool. Ne faites cela que si l'hôte est physiquement absent ou irrécupérable - s'il peut revenir en ligne, utilisez à la place Détacher. Cette action ne peut pas être annulée.",
|
||||
"modal:host-reboot-message": "L'hôte va redémarrer. Ses VMs en cours d'exécution seront migrées vers d'autres hôtes et ne reviendront pas automatiquement dessus après l'opération.",
|
||||
"modal:host-restart-toolstack-message": "Le service de gestion de l'hôte (toolstack) est sur le point de redémarrer. Les VMs en cours d'exécution ne seront pas interrompues, mais elles seront temporairement ingérables (quelques minutes).",
|
||||
"modal:host-shutdown-message": "Cela éteindra l'hôte. Toute VM encore en cours d’exécution sera immédiatement arrêtée, à moins que vous ne l'ayez migrée au préalable.",
|
||||
"modal:host-smart-reboot-message": "Toutes les VMs en cours d'exécution sur cet hôte seront suspendues, l'hôte redémarrera, puis les VMs reprendront automatiquement. Cela entraîne une interruption temporaire. Si Xen Orchestra lui-même s'exécute sur cet hôte, les VMs pourraient ne pas reprendre automatiquement.",
|
||||
"modal:pool-disconnect-message": "Le pool ne pourra plus être géré depuis XO. Vous pourrez le reconnecter ultérieurement.",
|
||||
|
||||
@@ -11,6 +11,7 @@ export type HostActions =
|
||||
| 'reboot'
|
||||
| 'force-reboot'
|
||||
| 'smart-reboot'
|
||||
| 'restart-toolstack'
|
||||
|
||||
export type VmBlockedOperations =
|
||||
| 'clean_shutdown'
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<HostPowerStateActions :host />
|
||||
<VtsDivider type="stretch" />
|
||||
</div>
|
||||
<template v-if="host.enabled || isHostHalted">
|
||||
<HostRestartToolstackButton :host />
|
||||
<template v-if="displayDisableButton">
|
||||
<HostDisableButton :host />
|
||||
<HostDisableAndEvacuateVmsButton :host />
|
||||
</template>
|
||||
@@ -26,6 +27,7 @@ import HostDownloadButton from '@/modules/host/components/actions/download/HostD
|
||||
import HostEnableButton from '@/modules/host/components/actions/enable/HostEnableButton.vue'
|
||||
import HostForgetButton from '@/modules/host/components/actions/forget/HostForgetButton.vue'
|
||||
import HostPowerStateActions from '@/modules/host/components/actions/HostPowerStateActions.vue'
|
||||
import HostRestartToolstackButton from '@/modules/host/components/actions/restart-toolstack/HostRestartToolstackButton.vue'
|
||||
import type { FrontXoHost } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
|
||||
import VtsDivider from '@core/components/divider/VtsDivider.vue'
|
||||
import MenuItem from '@core/components/menu/MenuItem.vue'
|
||||
@@ -44,6 +46,8 @@ const { t } = useI18n()
|
||||
const uiStore = useUiStore()
|
||||
|
||||
const isHostHalted = computed(() => host.power_state === HOST_POWER_STATE.HALTED)
|
||||
|
||||
const displayDisableButton = computed(() => host.enabled || isHostHalted.value)
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<MenuItem
|
||||
v-tooltip="!canRestartToolstack && restartToolstackErrorMessage"
|
||||
:disabled="!canRestartToolstack"
|
||||
icon="action:reboot"
|
||||
:busy="isRestartingToolstack"
|
||||
@click="restartToolstack()"
|
||||
>
|
||||
{{ t('action:restart-toolstack') }}
|
||||
</MenuItem>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useXoHostRestartToolstackJob } from '@/modules/host/jobs/xo-host-restart-toolstack.job.ts'
|
||||
import type { FrontXoHost } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
|
||||
import MenuItem from '@core/components/menu/MenuItem.vue'
|
||||
import { useActionModal } from '@core/composables/modals/use-action-modal.ts'
|
||||
import { vTooltip } from '@core/directives/tooltip.directive.ts'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { host } = defineProps<{
|
||||
host: FrontXoHost
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const {
|
||||
run,
|
||||
canRun: canRestartToolstack,
|
||||
isRunning: isRestartingToolstack,
|
||||
errorMessage: restartToolstackErrorMessage,
|
||||
} = useXoHostRestartToolstackJob(() => host)
|
||||
|
||||
const { open: openActionModal } = useActionModal()
|
||||
|
||||
function restartToolstack() {
|
||||
return openActionModal({
|
||||
props: {
|
||||
accent: 'info',
|
||||
action: 'restart-toolstack',
|
||||
object: 'host',
|
||||
hostName: host.name_label,
|
||||
icon: 'status:info-picto',
|
||||
},
|
||||
events: {
|
||||
onConfirm: async () => {
|
||||
void run()
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,35 @@
|
||||
import { xoHostArg } from '@/modules/host/jobs/xo-host-args.ts'
|
||||
import type { FrontXoHost } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
|
||||
import type { FrontXoTask } from '@/modules/task/remote-resources/use-xo-task-collection.ts'
|
||||
import { useXoTaskUtils } from '@/shared/composables/xo-task-utils.composable.ts'
|
||||
import { fetchPost } from '@/shared/utils/fetch.util.ts'
|
||||
import { defineJob, JobError, JobRunningError } from '@core/packages/job'
|
||||
import { HOST_POWER_STATE } from '@vates/types'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
export const useXoHostRestartToolstackJob = defineJob('host.restart-toolstack', [xoHostArg], () => {
|
||||
const { t } = useI18n()
|
||||
const { monitorTask } = useXoTaskUtils()
|
||||
|
||||
return {
|
||||
async run(host: FrontXoHost) {
|
||||
const { taskId } = await fetchPost<{ taskId: FrontXoTask['id'] }>(`hosts/${host.id}/actions/restart_toolstack`)
|
||||
await monitorTask(taskId)
|
||||
},
|
||||
|
||||
validate: (isRunning, host: FrontXoHost | undefined) => {
|
||||
if (!host) {
|
||||
throw new JobError(t('job:host-restart-toolstack:missing-host'))
|
||||
}
|
||||
|
||||
// For now, the only loader we have for the restart toolstack action is this one. A fix is in progress on the backend side to show the loader on the other buttons, the treeview, etc.
|
||||
if (isRunning) {
|
||||
throw new JobRunningError(t('job:host-restart-toolstack:in-progress'))
|
||||
}
|
||||
|
||||
if (host.power_state !== HOST_POWER_STATE.RUNNING) {
|
||||
throw new JobError(t('job:host-restart-toolstack:bad-power-state'))
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
- [i18n] Add Arabic and update Czech, Dutch, Finnish, Portuguese (Brasil), Slovak and Swedish translations (PR [#10181](https://github.com/vatesfr/xen-orchestra/pull/10181))
|
||||
- [XO6/Backups] Add header title on backup job detail page (PR [#10303](https://github.com/vatesfr/xen-orchestra/pull/10303))
|
||||
- [XO6/Host] Add possibility to restart a host toolstack (PR [#10178](https://github.com/vatesfr/xen-orchestra/pull/10178))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
@@ -20,7 +21,6 @@
|
||||
|
||||
- [sdn-controller] Fix `update_traffic_rule` keeping the previous port: `newRule` is a partial update and a field sent as `null` is now removed from the rule (PR [#10307](https://github.com/vatesfr/xen-orchestra/pull/10307))
|
||||
|
||||
|
||||
### Packages to release
|
||||
|
||||
> When modifying a package, add it here with its release type.
|
||||
|
||||
Reference in New Issue
Block a user