fix(xo-server/clearHost): explicit message on missing migration network

Fixes zammad#14882
This commit is contained in:
Julien Fontanet
2023-05-30 16:50:50 +02:00
parent 3f316fcaea
commit e2695ce327
2 changed files with 11 additions and 3 deletions

View File

@@ -13,7 +13,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Incremental Replication] Fix task showing as *interrupted* when running without health check [Forum#62669](https://xcp-ng.org/forum/post/62669) (PR [#6866](https://github.com/vatesfr/xen-orchestra/pull/6866))
- [Incremental Replication] Fix task showing as _interrupted_ when running without health check [Forum#62669](https://xcp-ng.org/forum/post/62669) (PR [#6866](https://github.com/vatesfr/xen-orchestra/pull/6866))
- [Host evacuation] Better error message when migration network no longer exists
### Packages to release

View File

@@ -182,8 +182,15 @@ export default class Xapi extends XapiBase {
async clearHost({ $ref: hostRef, $pool: pool }, force) {
await this.call('host.disable', hostRef)
const migrationNetworkId = pool.other_config['xo:migrationNetwork']
const migrationNetworkRef = migrationNetworkId && this.getObject(migrationNetworkId).$ref
const migrationNetworkRef = (id => {
if (id !== undefined) {
const network = this.getObject(id, undefined)
if (network === undefined) {
throw new Error('could not find migration network ' + id)
}
return network.$ref
}
})(pool.other_config['xo:migrationNetwork'])
try {
try {
await (migrationNetworkRef === undefined