feat(xo-server/clearHost): use pool's default migration network (#5851)
Fixes #5802 See xoa-support#3118
This commit is contained in:
parent
bc6afc3933
commit
b2a56c047c
@ -12,6 +12,7 @@
|
||||
- [SR/disks] Display base copies' active VDIs (PR [#5826](https://github.com/vatesfr/xen-orchestra/pull/5826))
|
||||
- [Netbox] Optionally allow self-signed certificates (PR [#5850](https://github.com/vatesfr/xen-orchestra/pull/5850))
|
||||
- [VM] shutdown/reboot: offer to force shutdown/reboot the VM if no Xen tools were detected [#5838](https://github.com/vatesfr/xen-orchestra/issues/5838) (PR [#5855](https://github.com/vatesfr/xen-orchestra/pull/5855))
|
||||
- [Host] When supported, use pool's default migration network to evacuate host [#5802](https://github.com/vatesfr/xen-orchestra/issues/5802) (PR [#5851](https://github.com/vatesfr/xen-orchestra/pull/5851))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
@ -42,3 +43,4 @@
|
||||
- xo-server-netbox minor
|
||||
- xo-server patch
|
||||
- xo-web minor
|
||||
- xo-server minor
|
||||
|
@ -185,14 +185,26 @@ export default class Xapi extends XapiBase {
|
||||
//
|
||||
// If `force` is false and the evacuation failed, the host is re-
|
||||
// enabled and the error is thrown.
|
||||
async clearHost({ $ref: ref }, force) {
|
||||
await this.call('host.disable', ref)
|
||||
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
|
||||
try {
|
||||
await this.callAsync('host.evacuate', ref)
|
||||
try {
|
||||
await (migrationNetworkRef === undefined
|
||||
? this.callAsync('host.evacuate', hostRef)
|
||||
: this.callAsync('host.evacuate', hostRef, migrationNetworkRef))
|
||||
} catch (error) {
|
||||
if (error.code === 'MESSAGE_PARAMETER_COUNT_MISMATCH') {
|
||||
await this.callAsync('host.evacuate', hostRef)
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (!force) {
|
||||
await this.call('host.enable', ref)
|
||||
await this.call('host.enable', hostRef)
|
||||
|
||||
throw error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user