fix(xo-server): ignore disabled remotes when running VM backup (#6430)

This commit is contained in:
Florent BEAUCHAMP 2022-09-26 14:50:30 +02:00 committed by GitHub
parent f82eb8aeb4
commit 2d6b827fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -22,6 +22,7 @@
- [Tasks] Fix the pool filter that did not display tasks even if they existed (PR [#6424](https://github.com/vatesfr/xen-orchestra/pull/6424))
- [Tasks] Fix tasks being displayed for all users (PR [#6422](https://github.com/vatesfr/xen-orchestra/pull/6422))
- [Storage/advanced] Fix the display of VDI to coalesce [#6334](https://xcp-ng.org/forum/topic/6334/coalesce-not-showing-anymore) (PR [#6429](https://github.com/vatesfr/xen-orchestra/pull/6429))
- [Backup] Ignore disabled remotes instead of failing the execution [#6347](https://github.com/vatesfr/xen-orchestra/issues/6374) (PR [#6430](https://github.com/vatesfr/xen-orchestra/pull/6430))
### Packages to release

View File

@ -193,9 +193,17 @@ export default class BackupNg {
const remotes = {}
const xapis = {}
const remoteErrors = {}
await waitAll([
asyncMapSettled(remoteIds, async id => {
const remote = await app.getRemoteWithCredentials(id)
let remote
try {
remote = await app.getRemoteWithCredentials(id)
} catch (error) {
log.warn('Error while instantiating remote', { error, remoteId: id })
remoteErrors[id] = error
return
}
if (remote.proxy !== proxyId) {
throw new Error(
proxyId === undefined
@ -221,6 +229,17 @@ export default class BackupNg {
}
}),
])
if (Object.keys(remotes).length === 0) {
const error = new Error(`couldn't instantiate any remote`)
error.errors = remoteErrors
throw error
}
// update remotes list with only the enabled remotes
job.remotes = {
id: {
__or: Object.keys(remotes),
},
}
const params = {
job,