Skip to content

Commit

Permalink
fix(xo-server): ignore disabled remotes when running VM backup (#6430)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeauchamp committed Sep 26, 2022
1 parent f82eb8a commit 2d6b827
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 20 additions & 1 deletion packages/xo-server/src/xo-mixins/backups-ng/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 2d6b827

Please sign in to comment.