diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index e54cc1f7b..0158e633d 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -7,6 +7,8 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” +- [Rolling Pool Update] New algorithm for XCP-ng updates (PR [#6188](https://github.com/vatesfr/xen-orchestra/pull/6188)) + ### Bug fixes > Users must be able to say: “I had this issue, happy to know it's fixed” @@ -36,4 +38,4 @@ - xen-api minor - xo-vmdk-to-vhd minor - @xen-orchestra/proxy patch -- xo-server patch +- xo-server minor diff --git a/packages/xo-server/src/xapi/mixins/patching.mjs b/packages/xo-server/src/xapi/mixins/patching.mjs index d9154c34f..64a7cc963 100644 --- a/packages/xo-server/src/xapi/mixins/patching.mjs +++ b/packages/xo-server/src/xapi/mixins/patching.mjs @@ -482,6 +482,8 @@ export default { @decorateWith(deferrable) async rollingPoolUpdate($defer) { + const isXcp = _isXcp(this.pool.$master) + if (this.pool.ha_enabled) { const haSrs = this.pool.$ha_statefiles.map(vdi => vdi.SR) const haConfig = this.pool.ha_configuration @@ -506,8 +508,11 @@ export default { await Promise.all(hosts.map(host => host.$call('assert_can_evacuate'))) - log.debug('Install patches') - await this.installPatches() + // On XS/CH, start by installing patches on all hosts + if (!isXcp) { + log.debug('Install patches') + await this.installPatches() + } // Remember on which hosts the running VMs are const vmsByHost = mapValues( @@ -546,10 +551,24 @@ export default { await this.barrier(metricsRef) await this._waitObjectState(metricsRef, metrics => metrics.live) - const rebootTime = parseDateTime(await this.call('host.get_servertime', host.$ref)) - log.debug(`Evacuate and restart host ${hostId}`) - await this.rebootHost(hostId) + const getServerTime = async () => parseDateTime(await this.call('host.get_servertime', host.$ref)) + let rebootTime + if (isXcp) { + // On XCP-ng, install patches on each host one by one instead of all at once + log.debug(`Evacuate host ${hostId}`) + await this.clearHost(host) + log.debug(`Install patches on host ${hostId}`) + await this.installPatches({ hosts: [host] }) + log.debug(`Restart host ${hostId}`) + rebootTime = await getServerTime() + await this.callAsync('host.reboot', host.$ref) + } else { + // On XS/CH, we only need to evacuate/restart the hosts one by one since patches have already been installed + log.debug(`Evacuate and restart host ${hostId}`) + rebootTime = await getServerTime() + await this.rebootHost(hostId) + } log.debug(`Wait for host ${hostId} to be up`) await timeout.call(