fix(xo-server/Rolling Pool Update/_xcpUpdate): handle undefined hosts (#6186)

Fixes #6170
Introduced by e7f9111ab5
This commit is contained in:
Pierre Donias 2022-04-13 13:22:30 +02:00 committed by GitHub
parent ef819f4d53
commit 3f1c41a4f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -14,6 +14,7 @@
- [Plugins] Automatically configure plugins when a configuration file is imported (PR [#6171](https://github.com/vatesfr/xen-orchestra/pull/6171))
- [VMDK Export] Fix `VBOX_E_FILE_ERROR (0x80BB0004)` when importing in VirtualBox (PR [#6163](https://github.com/vatesfr/xen-orchestra/pull/6163))
- [Backup] Fix "Cannot read properties of undefined" error when restoring from a proxied remote (PR [#6179](https://github.com/vatesfr/xen-orchestra/pull/6179))
- [Rolling Pool Update] Fix "cannot read properties of undefined" error [#6170](https://github.com/vatesfr/xen-orchestra/issues/6170) (PR [#6186](https://github.com/vatesfr/xen-orchestra/pull/6186))
### Packages to release

View File

@ -116,7 +116,6 @@ listMissingPatches.resolve = {
// -------------------------------------------------------------------
export async function installPatches({ pool, patches, hosts }) {
const opts = { patches }
let xapi
if (pool !== undefined) {
pool = this.getXapiObject(pool, 'pool')
@ -124,7 +123,6 @@ export async function installPatches({ pool, patches, hosts }) {
hosts = Object.values(xapi.objects.indexes.type.host)
} else {
hosts = hosts.map(_ => this.getXapiObject(_))
opts.hosts = hosts
xapi = hosts[0].$xapi
pool = xapi.pool
}
@ -138,7 +136,7 @@ export async function installPatches({ pool, patches, hosts }) {
})
}
await xapi.installPatches(opts)
await xapi.installPatches({ hosts, patches })
const masterRef = pool.master
if (moveFirst(hosts, _ => _.$ref === masterRef)) {

View File

@ -308,6 +308,10 @@ export default {
// INSTALL -------------------------------------------------------------------
async _xcpUpdate(hosts) {
if (hosts === undefined) {
hosts = Object.values(this.objects.indexes.type.host)
}
// XCP-ng hosts need to be updated one at a time starting with the pool master
// https://github.com/vatesfr/xen-orchestra/issues/4468
hosts = hosts.sort(({ $ref }) => ($ref === this.pool.master ? -1 : 1))