diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 6842ae3c795..62414269cba 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -7,6 +7,8 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” +- [Host/SmartReboot] Allow to force smartReboot if VMs have suspended operation blocks (PR [#7025](https://github.com/vatesfr/xen-orchestra/pull/7025)) + ### Bug fixes > Users must be able to say: “I had this issue, happy to know it's fixed” @@ -32,6 +34,6 @@ - xen-api patch - xo-server minor -- xo-web patch +- xo-web minor diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index 596280f0608..1723c156b60 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -950,6 +950,8 @@ const messages = { smartRebootHostLabel: 'Smart reboot', smartRebootHostTooltip: 'Suspend resident VMs, reboot host and resume VMs automatically', forceRebootHostLabel: 'Force reboot', + forceSmartRebootHost: + '{nVms, number} VM{nVms, plural, one {} other {s}} have suspended operation blocks. Would you like to force?', rebootHostLabel: 'Reboot', noHostsAvailableErrorTitle: 'Error while restarting host', noHostsAvailableErrorMessage: diff --git a/packages/xo-web/src/common/xo/index.js b/packages/xo-web/src/common/xo/index.js index ee49359d4c2..69e07c05de7 100644 --- a/packages/xo-web/src/common/xo/index.js +++ b/packages/xo-web/src/common/xo/index.js @@ -821,13 +821,38 @@ export const setRemoteSyslogHost = (host, syslogDestination) => export const setRemoteSyslogHosts = (hosts, syslogDestination) => Promise.all(map(hosts, host => setRemoteSyslogHost(host, syslogDestination))) -export const restartHost = (host, force = false, suspendResidentVms = false) => +export const restartHost = (host, force = false, suspendResidentVms = false, forceSmartReboot = false) => confirm({ title: _('restartHostModalTitle'), body: _('restartHostModalMessage'), }).then( () => - _call('host.restart', { id: resolveId(host), force, suspendResidentVms }) + _call('host.restart', { id: resolveId(host), force, suspendResidentVms, forceSmartReboot }) + .catch(async error => { + if ( + suspendResidentVms && + !forceSmartReboot && + operationBlocked.is(error, { + code: 'suspend', + }) + ) { + await confirm({ + body: ( +
+