feat(xo-server/rpu): update hosts one by one on XCP-ng (#6188)

This commit is contained in:
Pierre Donias 2022-04-13 16:38:23 +02:00 committed by GitHub
parent 3f1c41a4f7
commit 2bd3d57f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 6 deletions

View File

@ -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

View File

@ -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(