Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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”
Expand Down Expand Up @@ -36,4 +38,4 @@
- xen-api minor
- xo-vmdk-to-vhd minor
- @xen-orchestra/proxy patch
- xo-server patch
- xo-server minor
29 changes: 24 additions & 5 deletions packages/xo-server/src/xapi/mixins/patching.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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}`)
pdonias marked this conversation as resolved.
Show resolved Hide resolved
rebootTime = await getServerTime()
await this.rebootHost(hostId)
}

log.debug(`Wait for host ${hostId} to be up`)
await timeout.call(
Expand Down