fix(xapi/host_smartReboot): resume VMs after enabling host (#6980)

Found when investigating https://xcp-ng.org/forum/post/60372
This commit is contained in:
Mathieu
2023-08-17 16:22:35 +02:00
committed by GitHub
parent 067f4ac882
commit 785a5857ef
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -32,9 +32,14 @@ class Host {
* @param {string} ref - Opaque reference of the host
*/
async smartReboot($defer, ref) {
const suspendedVms = []
if (await this.getField('host', ref, 'enabled')) {
await this.callAsync('host.disable', ref)
$defer(() => this.callAsync('host.enable', ref))
$defer(async () => {
await this.callAsync('host.enable', ref)
// Resuming VMs should occur after host enabling to avoid triggering a 'NO_HOSTS_AVAILABLE' error
return asyncEach(suspendedVms, vmRef => this.callAsync('VM.resume', vmRef, false, false))
})
}
let currentVmRef
@@ -51,7 +56,7 @@ class Host {
try {
await this.callAsync('VM.suspend', vmRef)
$defer(() => this.callAsync('VM.resume', vmRef, false, false))
suspendedVms.push(vmRef)
} catch (error) {
const { code } = error
+2
View File
@@ -19,6 +19,7 @@
- [File Restore] Increase timeout from one to ten minutes when restoring through XO Proxy
- [Home/VMs] Filtering with a UUID will no longer show other VMs on the same host/pool
- [Jobs] Fixes `invalid parameters` when editing [Forum#64668](https://xcp-ng.org/forum/post/64668)
- [Smart reboot] Fix cases where VMs remained in a suspended state (PR [#6980](https://github.com/vatesfr/xen-orchestra/pull/6980))
### Packages to release
@@ -38,6 +39,7 @@
- @xen-orchestra/backups patch
- @xen-orchestra/mixins minor
- @xen-orchestra/xapi patch
- xen-api patch
- xo-server minor
- xo-server-auth-ldap patch