fix(xo-server/patching): install XCP-ng patches host by host (#4532)

Fixes #4468

To prevent issues where 2 hosts try to modify the XAPI DB at the same time
This commit is contained in:
Pierre Donias
2019-10-12 00:39:17 +02:00
committed by Julien Fontanet
parent 3483e7d9e0
commit e2f5b30aa9

View File

@@ -1,4 +1,3 @@
import asyncMap from '@xen-orchestra/async-map'
import createLogger from '@xen-orchestra/log'
import deferrable from 'golike-defer'
import unzip from 'julien-f-unzip'
@@ -337,7 +336,7 @@ export default {
// INSTALL -------------------------------------------------------------------
_xcpUpdate(hosts) {
async _xcpUpdate(hosts) {
if (hosts === undefined) {
hosts = filter(this.objects.all, { $type: 'host' })
} else {
@@ -347,7 +346,10 @@ export default {
)
}
return asyncMap(hosts, async 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))
for (const host of hosts) {
const update = await this.call(
'host.call_plugin',
host.$ref,
@@ -364,7 +366,7 @@ export default {
String(Date.now() / 1000)
)
}
})
}
},
// Legacy XS patches: upload a patch on a pool before installing it