feat(xo-server#_startVm): add a message for 'NO_HOSTS_AVAILABLE' error (#6408)

This commit is contained in:
rajaa-b 2022-09-09 10:43:22 +02:00 committed by GitHub
parent b0006f91f4
commit 8b7d2aab6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 10 deletions

View File

@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Plugin/auth-saml] Certificate input support multiline (PR [#6403](https://github.com/vatesfr/xen-orchestra/pull/6403))
- [Start VM] Clearer error message when `NO_HOSTS_AVAILABLE` error is triggered [#6316](https://github.com/vatesfr/xen-orchestra/issues/6316) (PR [#6408](https://github.com/vatesfr/xen-orchestra/pull/6408))
### Packages to release

View File

@ -882,16 +882,20 @@ export default class Xapi extends XapiBase {
throw error
}
throw new AggregateError(
await asyncMap(await this.call('host.get_all'), async hostRef => {
const hostNameLabel = await this.call('host.get_name_label', hostRef)
try {
await this.call('VM.assert_can_boot_here', vmRef, hostRef)
return `${hostNameLabel}: OK`
} catch (error) {
return `${hostNameLabel}: ${error.message}`
}
})
throw Object.assign(
new AggregateError(
await asyncMap(await this.call('host.get_all'), async hostRef => {
const hostNameLabel = await this.call('host.get_name_label', hostRef)
try {
await this.call('VM.assert_can_boot_here', vmRef, hostRef)
return `${hostNameLabel}: OK`
} catch (error) {
return `${hostNameLabel}: ${error.message}`
}
}),
error.message
),
{ code: error.code, params: error.params }
)
}
} else {