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

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

Merged
merged 6 commits into from
Sep 26, 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
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 })
julien-f marked this conversation as resolved.
Show resolved Hide resolved
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