diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 4e5ce3db0..303b42511 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -11,6 +11,7 @@ - [Dashboard/Health] Add free space column for storage state table (PR [#6778](https://github.com/vatesfr/xen-orchestra/pull/6778)) - [VM/General] Displays the template name used to create the VM, as well as the email address of the VM creator for admin users (PR [#6771](https://github.com/vatesfr/xen-orchestra/pull/6771)) - [Backup/exports] Retry when failing to read a data block during Delta Backup, Continuous Replication, disk and OVA export when NBD is enabled [PR #6763](https://github.com/vatesfr/xen-orchestra/pull/6763) +- [Host] Smart reboot: suspend resident VMs, restart host and resume VMs [#6750](https://github.com/vatesfr/xen-orchestra/issues/6750) (PR [#6795](https://github.com/vatesfr/xen-orchestra/pull/6795)) ### Bug fixes diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index 507e5d701..3cbf6e383 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -931,6 +931,8 @@ const messages = { enableHostLabel: 'Enable', disableHostLabel: 'Disable', restartHostAgent: 'Restart toolstack', + smartRebootHostLabel: 'Smart reboot', + smartRebootHostTooltip: 'Suspend resident VMs, reboot host and resume VMs automatically', forceRebootHostLabel: 'Force reboot', rebootHostLabel: 'Reboot', noHostsAvailableErrorTitle: 'Error while restarting host', diff --git a/packages/xo-web/src/common/xo/index.js b/packages/xo-web/src/common/xo/index.js index f491f84d4..9e2baeb4e 100644 --- a/packages/xo-web/src/common/xo/index.js +++ b/packages/xo-web/src/common/xo/index.js @@ -785,13 +785,13 @@ export const setRemoteSyslogHost = (host, syslogDestination) => export const setRemoteSyslogHosts = (hosts, syslogDestination) => Promise.all(map(hosts, host => setRemoteSyslogHost(host, syslogDestination))) -export const restartHost = (host, force = false) => +export const restartHost = (host, force = false, suspendResidentVms = false) => confirm({ title: _('restartHostModalTitle'), body: _('restartHostModalMessage'), }).then( () => - _call('host.restart', { id: resolveId(host), force }) + _call('host.restart', { id: resolveId(host), force, suspendResidentVms }) .catch(async error => { if ( forbiddenOperation.is(error, { @@ -809,7 +809,7 @@ export const restartHost = (host, force = false) => ), title: _('restartHostModalTitle'), }) - return _call('host.restart', { id: resolveId(host), force, bypassBackupCheck: true }) + return _call('host.restart', { id: resolveId(host), force, suspendResidentVms, bypassBackupCheck: true }) } throw error }) diff --git a/packages/xo-web/src/icons.scss b/packages/xo-web/src/icons.scss index 598145736..f2ecb16fd 100644 --- a/packages/xo-web/src/icons.scss +++ b/packages/xo-web/src/icons.scss @@ -181,6 +181,10 @@ @extend .fa; @extend .fa-play; } + &-freeze { + @extend .fa; + @extend .fa-snowflake-o; + } &-forget { @extend .fa; @extend .fa-ban; diff --git a/packages/xo-web/src/xo-app/host/tab-advanced.js b/packages/xo-web/src/xo-app/host/tab-advanced.js index b6a515aa3..e6fc65e95 100644 --- a/packages/xo-web/src/xo-app/host/tab-advanced.js +++ b/packages/xo-web/src/xo-app/host/tab-advanced.js @@ -62,6 +62,8 @@ const SCHED_GRAN_TYPE_OPTIONS = [ const forceReboot = host => restartHost(host, true) +const smartReboot = host => restartHost(host, false, true) // don't force, suspend resident VMs + const formatPack = ({ name, author, description, version }, key) => ( {_('supplementalPackTitle', { author, name })} @@ -253,15 +255,25 @@ export default class extends Component { ) : ( telemetryButton )} - {host.power_state === 'Running' && ( + {host.power_state === 'Running' && [ , + - )} + />, + ]} {host.enabled ? (